1. PHP / Говнокод #4496

    +168

    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
    <?php
    Class Draw
    {
    // вырисовка графика баланса
    	function Graph($y1,$y2,$y3,$y4,$y5,$y6,$y7,$firstday) {
    		header ("Content-type: image/png");
    		$im = imagecreatefrompng("graph.png");
    		$text_color = imagecolorallocate($im, 233, 14, 91);
    		$color = imagecolorallocate($im, 0, 0, 0);
    		$bg = imagecolorallocate($im, 180, 180, 200);
    		#--------------------------------------------------------
    		imagefill ($im, 0, 0, $bg);
    		#---------------------------------------------------------
    		imageline($im, 50, 0, 1000, 0, $color);
    // в это же духе еще ~10 строк
    		imageline($im, 50, 900, 1000, 900, $color);
    		#---------------------------------------------------------
    		imageline($im, 100, 950, 100, 0, $color);
    // аналогично
    		imageline($im, 700, 950, 700, 0, $color);
    		#---------------------------------------------------------
    		imageline($im, 100, 1000-$y1, 200, 1000-$y2, $text_color);
    		imagefilledellipse ($im, 100, 1000-$y1, 10, 10, $color);
    		imagestring($im, 3, 115, 1000-$y1, $y1 . " RUB", $text_color);
    		imagestring($im, 5, 90, 960, $firstday, $text_color);
    		#-----------------------------------------------------------
    		imageline($im, 200, 1000-$y2, 300, 1000-$y3, $text_color);
    		imagefilledellipse ($im, 200, 1000-$y2, 10, 10, $color);
    		imagestring($im, 3, 215, 1000-$y2, $y2 . " RUB", $text_color);
    		imagestring($im, 5, 190, 960, $firstday+1, $text_color);
    		#-------------------------------------------------------------
    		imageline($im, 300, 1000-$y3, 400, 1000-$y4, $text_color);
    		imagefilledellipse ($im, 300, 1000-$y3, 10, 10, $color);
    		imagestring($im, 3, 315, 1000-$y3, $y3 . " RUB", $text_color);
    		imagestring($im, 5, 290, 960, $firstday+2, $text_color);
    		#------------------------------------------------------------
    		imageline($im, 400, 1000-$y4, 500, 1000-$y5, $text_color);
    		imagefilledellipse ($im, 400, 1000-$y4, 10, 10, $color);
    		imagestring($im, 3, 415, 1000-$y4, $y4 . " RUB", $text_color);
    		imagestring($im, 5, 390, 960, $firstday+3, $text_color);
    		#-----------------------------------------------------------
    		imageline($im, 500, 1000-$y5, 600, 1000-$y6, $text_color);
    		imagefilledellipse ($im, 500, 1000-$y5, 10, 10, $color);
    		imagestring($im, 3, 515, 1000-$y5, $y5 . " RUB", $text_color);
    		imagestring($im, 5, 490, 960, $firstday+4, $text_color);
    		#------------------------------------------------------------
    		imageline($im, 600, 1000-$y6, 700, 1000-$y7, $text_color);
    		imagefilledellipse ($im, 600, 1000-$y6, 10, 10, $color);
    		imagestring($im, 3, 615, 1000-$y6, $y6 . " RUB", $text_color);
    		imagestring($im, 5, 590, 960, $firstday+5, $text_color);
    		#------------------------------------------------------------
    		imagefilledellipse ($im, 700, 1000-$y7, 10, 10, $color);
    		imagestring($im, 3, 715, 1000-$y7, $y7 . " RUB", $text_color);
    		imagestring($im, 5, 690, 960, $firstday+6, $text_color);
    		#---------------------------------------------------------
    		imagestring($im, 5, 0, 900, 100, $text_color);
    		imagestring($im, 5, 0, 800, 200, $text_color);
    		imagestring($im, 5, 0, 700, 300, $text_color);
    		imagestring($im, 5, 0, 600, 400, $text_color);
    		imagestring($im, 5, 0, 500, 500, $text_color);
    		imagestring($im, 5, 0, 400, 600, $text_color);
    		imagestring($im, 5, 0, 300, 700, $text_color);
    		imagestring($im, 5, 0, 200, 800, $text_color);
    		imagestring($im, 5, 0, 100, 900, $text_color);
    		imagestring($im, 5, 0, 0, 1000, $text_color);
    		#---------------------------------------------------------
    		imagepng($im);
    		imagedestroy($im);
    	}
    }
    ?>

    той же 3х летней давности.....комментарии излишни

    Steel2010, 31 Октября 2010

    Комментарии (4)
  2. PHP / Говнокод #4495

    +164

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    function CheckDBInsert($str)
    {
    $arr = array("INSERT","SELECT","UPDATE","DELETE","FLUSH","UNION","CONCAT","SET","GRANT","--",";","..","'","-","%","(",")");
    foreach ($arr as $v) {
    $pos = strpos($str, $v);
    if ($pos === false) {
    	} else {
    return "ОШИБКО";
    die();
    }
    }

    код мой 3-летней давности....я плакалЬ(но он работал!)

    Steel2010, 31 Октября 2010

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

    +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
    // Итак, определим класс Namer.
    class Namer {
       var $name;
       var $surname;
       function getName() { return $this->name; }
       function getSurname() { return $this->surname; }
    }
    
    
    
    // Как видим, интерфейсная часть полностью определена. Осталось реализовать два механизма обработки входной строки. Сделаем это мы в двух классах-наследниках SpaceNamer и CommaNamer.
    
    
    //// класс для обработки строки в формате "имя фамилия"
    class SpaceNamer extends Namer {
       function SpaceNamer($full_name) {
          $splitter_pos = strpos($full_name, ' '); // находим пробел
          $this->name = substr($full_name, 0, $splitter_pos); // все, что до пробела - это имя
          $this->surname = substr($full_name, $splitter_pos+1); // после пробела - фамилия
       }
    }
    
    //// класс для обработки строки в формате "фамилия,имя"
    class CommaNamer extends Namer {
       function CommaNamer($full_name) {
          $splitter_pos = strpos($full_name, ','); // находим запятую
          $this->name = substr($full_name, $splitter_pos+1); // все, что до запятой - это фамилия
          $this->surname = substr($full_name, 0, $splitter_pos); // после запятой - имя
       }
    }

    и интерфейсы не нужны!

    Morgan, 31 Октября 2010

    Комментарии (14)
  4. VisualBasic / Говнокод #4493

    −83

    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
    Public Class Form1...
    
    Dim isClicked as Integer = false
    
    End class
    
    if isClicked = true then
    me.left = mouseposition.x - Me.width / 2
    me.top = mouseposition.y - me.height / 2
    end if
    
    if isClicked = false Then
    isClicked = true
    else
    isClicked = false
    end if...

    Код не мой... Но integer в виде false очень улыбнул ))) да собственно говоря и не только он )))

    psyhco1219, 31 Октября 2010

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

    +166

    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
    #include "stdafx.h"
    #include <iostream>
    #include <locale>
    #include <conio.h>
    typedef unsigned short int g;
    int main()
    {
            g b=0;g m=1;
            std::wcout.imbue(std::locale(".866"));
            for(g i=0;m==1;i++)
            {
            try
            {
            std::wcout<<L"Введите столбец по которому надо сортировать(меньше 10)";
            std::cin>>b;m=0;
            }
            catch(...){m=1;}
            }
            return EXIT_SUCCESS;
    }

    http://www.cyberforum.ru/cpp/thread550.html
    "Здравствуйте! мне надо чтобы если юзер вводит неверные данные ему было предложено вновь ввести данные заново.Почему этого не происходит"

    OverOverMind, 31 Октября 2010

    Комментарии (3)
  6. Куча / Говнокод #4491

    +139

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <noindex>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    ...
    <noindex>

    Заказчик попросил изменить шаблон. Открываю, а там это

    Setti, 31 Октября 2010

    Комментарии (25)
  7. PHP / Говнокод #4490

    +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
    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
    print "<form method=post name=\"main\" action=\"xz.php\" enctype=\"multipart/form-data\">\n";
    $box=$_POST['box'];
    while (list ($key,$val) = @each ($box)) {
    
     $size=filesize($server[$_GET['server']].":"."/".$val);
           if ($size < 0) $size=sprintf("%u", $size);
          $size=format_size($size, 0, 1);
    echo "<input type=\"text\" size=55 name=\"file_name\"  value=\"".$val."\">
    <input type=\"text\" size=25 name=\"film_name\"  value=\"\">
    <input type=\"text\" size=10 name=\"file_razmer\"  value=\"".$size."\">
    <input type=\"text\" size=1 name=\"file_server\"  value=\"".$_GET['server']."\">
    <select name=\"file_kachestvo\" size=1 >
    <option value=0></option>
    <option value=CamRip>CamRip</option>
    <option value=Telesync>Telesync</option>
    <option value=Promo DVD>Promo DVD</option>
    <option value=Telecine (TC)>Telecine (TC)</option>
    <option value=VHSrip>VHSrip</option>
    <option value=TVrip>TVrip</option>
    <option value=SATrip>SATrip</option>
    <option value=HDrip>HDrip</option>
    <option value=WEBrip>WEBrip</option>
    <option value=DVDRip>DVDRip</option></select>";
    print "<select name=\"file_serial\" size=1 >\n";
    for ($i=0; $i<count($serials); $i++) {
        print "\t\t<option value=".$serials[$i]['id'];
        if (@$_GET['mode']=="edit") if ($category[$i]['id']==$base_files[$index]['file_category']) print " selected";
        print ">".$serials[$i]['name_serials']."</option>\n";
    }
    print "</select></td>\n";
    print "</tr>\n";
    echo "";
    
    }
    print "<td colspan=2 align=center><input type=\"submit\" value=\"Добавить\"></td>\n";
    echo "</form>";
    
    //---------- и тут кагбэ обработчик формы--------------
    <?
    include ('config2.php');
    
    
        if ($_POST['file_serial']==0) {
            print "<p>Ошибка! Не заполныны обязательные поля:<br><br>\n";
            if ($_POST['file_serial']==0) print "<li>Сериал</br>\n";
            print "<br><a href=\"#\" onClick=\"history.back()\">Вернуться на сайт</a></p>";
            die();
        }
    //    $_POST['file_description'] = addslashes($_POST['file_description']);
        if ($_POST['file_serial'])
        $query="INSERT INTO files VALUES (";
        $query.="'',";
        $query.="'".$_POST['file_name']."',";
        $query.="'".$_POST['film_name']."',";
        $query.="'',";
        $query.="'',";
        $query.="'',";
        $query.="'',";
        $query.="'',";
        $query.="'',";
        $query.="'".$_POST['file_razmer']."',";
        $query.="'".$_POST['file_server']."',";
        $query.="'".$_POST['file_kachestvo']."',";
        $query.="'',";
        $query.="'',";
        $query.="'',";
        $query.="'',";
        $query.="'',";
        $query.="'".$_POST['file_serial']."',";
        $query.="'',";
        $query.="'0',";
        $query.="'',";
        $query.="'',";
        $query.="'0'";
        $query.=");";
        if (mysql_query ($query)) print "<p align=center>Сериал успешно добавлен в базу</p>";
        else print "<p align=center>Query failed</p>";
        print "<p align=center><a href=\"#\" onClick=\"history.back(-2)\">Вернуться на сайт</a></p>";
        die();
    ?>

    это гениально. вы не находите? http://forum.searchengines.ru/showpost.php?p=7879190&postcount=5

    GoodTalkBot, 31 Октября 2010

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

    +127

    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
    public static int[] filtrs;
            public string filtrStr;
            public double ProizvDO;
            public double ProizvOT;
            public double SprosDO;
            public double SprosOT;
            public double StXranDO;
            public double StXranOT;
            public double WtrafDO;
            public double WtrafOT;
    
             public double OtDo
            {
                get
                {
                    return ProizvOT;
                    return ProizvDO;
                    return SprosOT;
                    return SprosDO;
                    return StXranOT;
                    return StXranDO;
                    return WtrafOT;
                    return WtrafDO;
                }
             }

    Да, это лаба какого-то студента. Но тем не менее смешно.
    P.S. Взято с www.cyberforum.ru

    psina-from-ua, 30 Октября 2010

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

    +175

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    string user="Администратор";
        char* qwe1;
        int i=0;
        for(i=0;user[i]!=0;i++){};
        qwe1[]=new char[i];
        for(int j=0;user[j]!=0;j++)qwe1[j]=user[j];

    перевод std::string в массив чаров

    niXman, 30 Октября 2010

    Комментарии (80)
  10. ActionScript / Говнокод #4487

    −167

    1. 1
    server_metods_link = (parent as main).loading_page;

    FDT почему-то не давал мне компилить без такой вот хитрой конструкции... обращение к parent вызывало "ошибку на этапе компиляции"

    KirAmp, 30 Октября 2010

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