1. Список говнокодов пользователя qbasic

    Всего: 120

  2. Куча / Говнокод #12049

    +122

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    data IdPState a r = IdPEnd r | IdPNeedInput | IdPHaveInput a
    {-# INLINE_STREAM idP #-}
    idP :: (Monad m) => Stream l a a r m r
    idP = Stream next IdPNeedInput where
    	{-# INLINE_INNER next #-}
    	next (IdPEnd r) = Done r
    	next IdPNeedInput = NeedInput IdPHaveInput IdPEnd
    	next (IdPHaveInput a) = HaveOutput IdPNeedInput (return ()) a
    
    {-# INLINE_STREAM pipe #-}
    pipe :: Monad m => Stream l a b r0 m r1 -> Stream Void b c r1 m r2 -> Stream l a c r0 m r2
    pipe (Stream nextL sL) (Stream nextR sR) = Stream next (Right (return (), sL, Right sR)) where
    	{-# INLINE_INNER next #-}
    	next (Left r) = Done r
    	next (Right (final, sL, Right sR)) = case nextR sR of
    		Skip sR' -> Skip (Right (final, sL, Right sR'))
    		HaveOutput sR' c o -> HaveOutput (Right (final, sL, Right sR')) (c >> final) o
    		NeedInput p c -> Skip (Right (final, sL, Left (p, c)))
    		Done r -> PipeM (final >> return (Left r))
    		PipeM ms -> PipeM (liftM (Right . (final, sL,) . Right) ms)
    		Leftover _ i -> absurd i
    	next (Right (final, sL, Left (p, c))) = case nextL sL of
    		Skip sL' -> Skip (Right (final, sL', Left (p, c)))
    		HaveOutput sL' final' o -> Skip (Right (final', sL', Right (p o)))
    		NeedInput pL cL -> NeedInput (Right . (final,, Left (p, c)) . pL) (Right . (final,, Left (p, c)) . cL)
    		Done r -> Skip (Right (return (), sL, Right (c r)))
    		PipeM ms -> PipeM (liftM (Right . (final,, Left (p, c))) ms)
    		Leftover sL' i -> Leftover (Right (final, sL', Left (p, c))) i
    
    {-# INLINE_STREAM purePipe #-}
    purePipe :: (forall m . Monad m => Stream l a b r0 m r1) -> (forall m . Monad m => Stream Void b c r1 m r2) -> (forall m . Monad m => Stream l a c r0 m r2)
    purePipe (Stream nextL sL) (Stream nextR sR) = Stream next (sL, Right sR) where
    	{-# INLINE_INNER next #-}
    	next (sL, Right sR) = case nextR sR of
    		Skip sR' -> Skip (sL, Right sR')
    		HaveOutput sR' _ o -> HaveOutput (sL, Right sR') (return ()) o
    		NeedInput p c -> Skip (sL, Left (p, c))
    		Done r -> Done r
    		PipeM ms -> Skip (sL, Right (runIdentity ms))
    		Leftover _ i -> absurd i
    	next (sL, Left (p, c)) = case nextL sL of
    		Skip sL' -> Skip (sL', Left (p, c))
    		HaveOutput sL' _ o -> Skip (sL', Right (p o))
    		NeedInput pL cL -> NeedInput ((, Left (p, c)) . pL) ((, Left (p, c)) . cL)
    		Done r -> Skip (sL, Right (c r))
    		PipeM ms -> Skip (runIdentity ms, Left (p, c))
    		Leftover sL' i -> Leftover (sL', Left (p, c)) i

    qbasic, 03 Ноября 2012

    Комментарии (23)
  3. PHP / Говнокод #7299

    +165

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    <?
    mysql_connect("localhost", "root",""); mysql_select_db("BD");
    //$zapros=mysql_query("select * from test where id=0"); //echo ($zapros);
    function menu($parent,$h) { $h++;
    $zapros=mysql_query("select * from test where id={$parent}");
    while($row=mysql_fetch_array($rezult)) { echo "{$row['name']}
    "; 
    $zapros1=mysql_query("select * from test where key={$row['id']}");
    while ($row1=mysql_fetch_array($zapros1)){ echo " 
    {$row1['name']}
    "; $p=$row1['id']; menu($p,$h);
    }
    }
    }
    
    menu(0,0);
    ?>

    qbasic, 20 Июля 2011

    Комментарии (11)
  4. Куча / Говнокод #7230

    +132

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    open System.Net
    open System.Text.RegularExpressions
    open System.Text
    open System
    
    type userInfo = 
        { User : string;
          Rating : double;}
    
    let  mutable Users  = []
    
    (* Заполняем списки юзверей *)
    let getUsersInfo s = 
        let mutable  m = Regex.Match(s, @">(?<user>[^<]+)</a></td>\s+<td class=""strength"">[^<]+</td>\s+<td class=""rating""><strong>(?<rating>[^<]+)") //+ Оптимизировать регулярку. (Page 2)
        while(m.Success) do
            let info = {User = m.Groups.["user"].Value;  Rating =  m.Groups.["rating"].Value |> double}
            Users <- Users @ [info]
            m <- m.NextMatch()
        
    (* скачивание страницы по индексу *)
    let getSourceForUsers p = 
        let url = "http://freehabr.ru/people/good/page" + string(p)
        let wc = new WebClient();
        let s = wc.DownloadString(url);
        printfn "Разобрана %i страница" p
        getUsersInfo s
    
    (* получить индекс последней страницы *)    
    let getLastPage =  
        let wc = new WebClient()
        wc.Encoding <- Encoding.UTF8
        let s = wc.DownloadString "http://freehabr.ru/people/"
        Regex.Match(s,@"(?<=e)\d+(?=/"">п)").Value |> int
    
    let lastPage = getLastPage
    
    let printList a =
        a |> List.iter (fun x -> printfn "%s рейтинг - %.2f" x.User x.Rating)
        Console.ReadKey() |> ignore
     
    [<EntryPoint>]
    let main(args:string[]) =
      printfn "Парсер юзерей с положительным (или нулевым) рейтингом"
      printfn "%i -- Количество страниц" lastPage
      printfn "scan --XX - __ Cбор списка пользователей от первой страницы до XX"
      printfn "scan --YY --XX __ Сбор списка пользователей от YY страницы до XX. \nXX не может быть больше, чем максимальное количество страниц в списках юзеров с положительной кармой"
    
      let userInput = Console.ReadLine();
      match userInput with
      | _ when userInput.StartsWith "scan --" -> let a = Regex.Split(userInput,"--")
                                                 let dig = a.[1] |> int
                                                 if a.Length = 2 then  // для первого варианта                                               
                                                    [1 .. dig] 
                                                    |> List.iter getSourceForUsers
                                                 else // для второго
                                                    [ dig .. a.[2] |> int ] 
                                                    |> List.iter getSourceForUsers
                                                 printfn "~~~\nЮзеры посчитаны"
                                                    
                                              
      | _ -> printfn "Завершение приложения"
             exit(1) 
      
      printfn "~~~~\nОбработка списка\n~~~~"
      printfn "usersGreaterRate --XX __ Показать пользователей,\nу которых рейтинг больше или равен XX"
      printfn "usersLessRate --XX __ Показать пользователей,\nу которых рейтинг меньше или равен XX"
      printfn "usersWithNamesBegins --String __ Показать пользователей,\nу которых имя начинается со строки String"
      let usersOper = Console.ReadLine()
      let param = Regex.Split(usersOper," --").[1] 
      match usersOper with
      | _ when usersOper.StartsWith "usersGreaterRate --" -> Users 
                                                             |> List.filter (fun x -> x.Rating > (param |> double))
                                                             |> printList
      | _ when usersOper.StartsWith "usersLessRate --" -> Users
                                                          |> List.filter (fun x -> x.Rating < (param |> double))
                                                          |> printList
      | _ when usersOper.StartsWith "usersWithNamesBegins --" -> Users
                                                                    |> List.filter (fun x -> x.User.StartsWith param)
                                                                    |> printList
      | _ -> printfn "Завершение приложения"
             exit(1) 
      0

    qbasic, 12 Июля 2011

    Комментарии (23)
  5. C# / Говнокод #6578

    +119

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    public static Bitmap DrawBarsChart(ChartType t, Size s)
        {
          double[] values = DataValues;
          string[] names = DataNames;
          Bitmap bmp = new Bitmap(s.Width, s.Height);
          if (t != ChartType.bars || names.Length != values.Length || names.Length < 2)
            return bmp;
          else
          {
            Graphics g = Graphics.FromImage(bmp as Image);
            g.Clear(Color.White);
            g.DrawLines(new Pen(Brushes.Black), new Point[] { new Point(20, 20), new Point(20, s.Height - 20), new Point(s.Width - 200, s.Height - 20) });
            int Columnwidth = (s.Width - 240) / values.Length;
            if (Columnwidth > 150) Columnwidth = 150;
            double maxvalue = values.Max();
            int counter = 1;
            int rangefirst;
            int rangesecond;
     
            while (true)
            {
              if (maxvalue / Math.Pow(10, counter) < 10)
              {
                rangefirst = (int)Math.Floor(maxvalue / Math.Pow(10, counter));
                rangesecond = (int)(maxvalue - rangefirst * Math.Pow(10, counter));
                break;
              }
              else
              {
                counter++;
              }
            }
            int rangepix = (s.Height - 60) / (rangefirst + 1);
            for (int i = 0; i < rangefirst + 1; i++)
            {
              g.DrawString((i * Math.Pow(10, counter)).ToString(), new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular),
                Brushes.Black, new PointF(0, s.Height - 30 - rangepix * i));
              g.DrawLine(new Pen(Brushes.Black), new Point(17, s.Height - 20 - rangepix * i), new Point(20, s.Height - 20 - rangepix * i));
            }
            Colors colors = new Colors(); //класс-контейнер цветов (99 штук)
            int startcolor = new Random(DateTime.Now.Millisecond).Next(99);
            int j = startcolor;
            int startx = 21;
            int ColumnNumber = 1;
            foreach (var value in values)
            {
              int curfirstrange = (int)Math.Floor(value / Math.Pow(10, counter));
              int cursecondrange = (int)(value - curfirstrange * Math.Pow(10, counter));
              int rangesmallpix = (int)(cursecondrange * rangepix / Math.Pow(10, counter));
              g.FillRectangle(new SolidBrush(colors.GetNextColor(j)), startx,
                s.Height - 20 - curfirstrange * rangepix - rangesmallpix, Columnwidth, curfirstrange * rangepix + rangesmallpix);
              g.DrawString(value.ToString(), new Font(FontFamily.GenericSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new PointF(startx + Columnwidth / 2 - 10,
                s.Height - 20 - curfirstrange * rangepix - rangesmallpix - 20));
              g.DrawString(ColumnNumber.ToString(), new Font(FontFamily.GenericSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new PointF(startx + Columnwidth / 2 - 10,
                s.Height - 10));
              ColumnNumber++;
              j++; if (j > 99) j = 0;
              startx += Columnwidth;
            }
            j = startcolor;
            int TopMargin = 20;
            foreach (string str in names)
            {
              string tmp = str;
              if (str.Length > 15)
                tmp = str.Substring(0, 15);
              g.FillRectangle(new SolidBrush(colors.GetNextColor(j)), s.Width - 200, TopMargin, 10, 10); //pucyeM LIBeTHbIe kBagpaTuku
              g.DrawString(tmp, new Font(FontFamily.GenericSerif, 12, FontStyle.Italic), Brushes.Black, new PointF(s.Width - 180, TopMargin - 6)); //pucyeM Hagnucu
              TopMargin += 20;
              j++; if (j > 99) j = 0;
            }
            return bmp;
          }
        }

    qbasic, 06 Мая 2011

    Комментарии (17)
  6. PHP / Говнокод #6465

    +161

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    $posts = $db->execAndReturnAll('select `id`, `user_id`, `theme_id`, `text` from `posts` order by `id` desc limit 5');
    
    $users = array();
    $themes = array();
    $groups = array();
    
    $l = sizeof($posts);
    for($i = 0; $i < $l; ++$i)
    {
    if(!in_array($posts[$i]['user_id']), $users)
        $users[] = $posts[$i]['user_id'];
    if(!in_array($posts[$i]['theme_id']), $themes)
        $themes[] = $posts[$i]['theme_id'];
    }
    
    $users = $db->execAndReturnAll('select `id`, `nick`, `group_id` from `users` where `id` in (0,'.implode(',', $users).')');
    $themes = $db->execAndReturnAll('select `id`, `name` from `themes` where `id` in (0,'.implode(',', $themes).')');
    
    $l = sizeof($users);
    for($i = 0; $i < $l; ++$i)
    {
    if(!in_array($users[$i]['group_id']), $groups)
        $groups[] = $users[$i]['group_id'];
    }
    
    $groups = $db->execAndReturnAll('select `id`, `name` from `groups` where `id` in (0,'.implode(',', $groups).')');

    qbasic, 24 Апреля 2011

    Комментарии (7)
  7. Python / Говнокод #6298

    −179

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    class Student(models.Model):
        fio = models.CharField(max_length=100)
        birthday = models.DateField()
        stud_tick = models.IntegerField()
        group = models.ForeignKey("Group")
        starosta = models.BooleanField()
     
        class Meta:
              unique_together = (("group", "starosta"),)
     
     
    class Group(models.Model):
        name = models.CharField(max_length=20)
     
    admin.site.register(Student)
    admin.site.register(Group)

    qbasic, 09 Апреля 2011

    Комментарии (10)
  8. C++ / Говнокод #6286

    +158

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    #ifndef _header_hpp_included_
    #define _header_hpp_included_
     
    #include <iostream>
    #include <cstdio>
    #include <boost/bind.hpp>
    #include <boost/asio.hpp>
    #include <boost/thread.hpp>
    #include <boost/lexical_cast.hpp>
     
    enum { recv_buffer_size = 13 };
    enum { send_buffer_size = 13 };
     
    volatile size_t counter = 0;
     
    void client_readed(
       boost::asio::ip::tcp::socket&,
       char*,
       FILE*,
       const boost::system::error_code&
    );
     
    void client_read(
       boost::asio::ip::tcp::socket& sock,
       FILE* out
    ) {
       char* buf = new char[recv_buffer_size];
       boost::asio::async_read(
          sock,
          boost::asio::buffer(buf, recv_buffer_size),
          boost::bind(
             &client_readed,
             boost::ref(sock),
             buf,
             out,
             boost::asio::placeholders::error));}
     
    void client_readed(
       boost::asio::ip::tcp::socket& sock,
       char* buf,
       FILE* out,
       const boost::system::error_code& e) {
       if ( e ) {
          if ( !counter ) return;
          std::cout << "read handler: " << e.message() << std::endl;
          return;
       }
        fwrite(buf, recv_buffer_size, 1, out);
        counter--;
     
    #ifdef _my_debug_
       printf("client_readed(): %s", buf);
       fflush(stdout);
    #endif
     
       static size_t idx = 0;
       size_t tmp = 0;
       char* p = strchr(buf, ':');
       if ( p ) {
          p++;
          sscanf(p, "%8d", &tmp);
       } else
          throw std::runtime_error("input data error!");
       delete[] buf;
       if ( idx != tmp ) {
          std::ostringstream os;
          os << "read error. expected " << idx << " get " << tmp;
          throw std::runtime_error(os.str());
       }
       idx++;
       client_read(sock, out);
    }
     
    void writen(
       char*,
       FILE*,
       const boost::system::error_code&
    );
     
    void start_write(
       boost::asio::ip::tcp::socket& sock,
       char* buf,
       FILE* out) {
       counter++;
       boost::asio::async_write(
          sock,
          boost::asio::buffer(buf, send_buffer_size),
          boost::bind(
             &writen,
             buf,
             out,
             boost::asio::placeholders::error) 
        ); 
    }

    qbasic, 08 Апреля 2011

    Комментарии (12)
  9. C++ / Говнокод #6285

    +161

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    #include "header.hpp"
     
    int main(int argc, char** argv) {
       if ( argc != 4 ) {
          std::cout << "client ip port 0/1 - sleed disabled/enabled" << std::endl;
          return 0;
       }
       std::string ip = argv[1];
       boost::uint16_t port = boost::lexical_cast<boost::uint16_t>(argv[2]);
       bool wsleep = (argv[3][0] == '1');
       std::cout << "sleep " << (wsleep?"enabled":"disabled") << std::endl;
       
       FILE* in = fopen("client_in.log", "wb");
       FILE* out= fopen("client_out.log", "wb");
       if ( !out || !in ) {
          std::cout << "can`t open file!" << std::endl;
          return 1;
       }
     
       boost::asio::ip::tcp::endpoint endpoint(
          boost::asio::ip::address::from_string(ip), port
       );
     
       boost::asio::io_service ios;
       boost::shared_ptr<boost::asio::io_service::work> work(new boost::asio::io_service::work(ios));
     
       boost::thread thread(boost::bind(&boost::asio::io_service::run, &ios));
       
       boost::asio::ip::tcp::socket socket(ios);
       socket.connect(endpoint);
     
       boost::asio::socket_base::non_blocking_io non_blocking_io(true);
       socket.io_control(non_blocking_io);
     
       client_read(socket, in);
     
       for ( size_t idx = 0; idx < 100000000; ++idx ) {
          char* buf = new char[send_buffer_size];
          sprintf(buf, "cs:%8dn", idx);
          start_write(socket, buf, out);
          if ( wsleep ) {
             boost::this_thread::sleep(boost::posix_time::microseconds(1000));
          }
       }
     
       std::cout
       << "send data to server finished!" << std::endl
       << "waiting for all ask`s from server..." << std::endl;
     
       work.reset();
     
       while ( counter ) {
          boost::this_thread::sleep(boost::posix_time::microseconds(1000));
          std::cout << "." << std::flush;
       }
     
       std::cout << std::endl << std::endl
       << "all ask`s received." << std::endl
       << "terminate client..." << std::endl;
     
       socket.cancel();
       socket.close();
     
       thread.join();
       fclose(in);
       fclose(out);
    }

    qbasic, 08 Апреля 2011

    Комментарии (10)
  10. PHP / Говнокод #6182

    +157

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    class IndexController extends \Zend\Controller\Action
    {       
     
        public function init()
        {
     
        }
     
        public function indexAction()
        {
                    $keyword = 'canon 600d';
                    $site = 'photodomain.ru';
            $page = new \Ivi\Scripts\Rambler\RamblerPage($keyword);
                    $html = \Ivi\Scripts\Rambler\RamblerLoader::getInstance()->get($page->current()); 
                    $position = \Ivi\Scripts\Rambler\RamblerParser::Check($html,$site);
                    
                    echo $position;
        }
    }

    qbasic, 01 Апреля 2011

    Комментарии (10)
  11. PHP / Говнокод #6056

    +160

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    <?
            if ($GET['cat'] == 'read') $y=date("Y");
                    else $y=$GET['cat'] ;
                    
            if ($GET['alb'] == 'read') $m=date("m");
                    else $m=$GET['alb'] ;
            
            if (!isset($y) OR $y < 1970 OR $y > 2037) $y=date("Y");
            if (!isset($m) OR $m < 1 OR $m > 12) $m=date("m");
     
            include_once './libs/mysql.php';
            
            $res='';
            $rows='';
            $date_array = array(); 
            $arraycount=1;          
    
                    
            $res = mysqlQuery("SELECT * 
                                                    FROM `". BG_DBPREFIX ."calendar`
                                                    WHERE YEAR(date)=".$y." AND MONTH(date)=".$m."
                                                    ORDER BY date ASC"
                                                    );
        if(mysql_num_rows($res) > 0)         // Если записи есть, вытаскиваем по одной в цикле 
                    {                                       
                    while($rows = htmlChars(mysql_fetch_assoc($res))) // попутно обрабатывая функцией htmlChars() 
            {
                            $date_array[$arraycount]['id']=$rows['id'];
                            $date_array[$arraycount]['date']=$rows['date'];
                            $date_array[$arraycount]['name']=$rows['name'];
                            $date_array[$arraycount]['status']=$rows['status'];
                            $arraycount++;
                    };
                    }
     
                    $prev_y=date('Y',mktime (0,0,0,$m-1,1,$y));
                    $prev_m=date('m',mktime (0,0,0,$m-1,1,$y));
                    $next_y=date('Y',mktime (0,0,0,$m+1,1,$y));
                    $next_m=date('m',mktime (0,0,0,$m+1,1,$y));
     
    echo "<a href=\"".href('cat='.$prev_y,'alb='.$prev_m)."\">Prev</a>";
    echo "<a href=\"".href('cat='.$next_y,'alb='.$next_m)."\">Next</a>";

    qbasic, 21 Марта 2011

    Комментарии (7)