1. Лучший говнокод

    В номинации:
    За время:
  2. PHP / Говнокод #4058

    +176

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    $submit=($a!=0)?true:false;
    if($submit==true)
    {
        redirect("index.php");
    }
    else
    {
        if($submit==false)
        {
    	  include_once("module.php");
        }
    }

    железная индусская логика

    zloiia, 22 Августа 2010

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

    +155

    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
    <?php
    
    include "conf_db.php";
    if(!empty($_REQUEST['doreg'])){
    $error=array();
    if(!$_REQUEST['name']) $error['name']="Имя";
    if(!$_REQUEST['pass']) $error['pass']="Пароль";
    if(!$_REQUEST['pass_to']) $error['pass_to']="Снова пароль";
    if(!$_REQUEST['e_mail']) $error['e_mail']="E-mail";
    
    if(!empty($error))
     {
     foreach ($error as $value)
      {
      echo "Не заполнено поле $value<br>";
      }
     include "form.php";
     }
     
     if(empty($error))
    {
     $error_to=array();
    if(trim($_REQUEST['pass']) !== trim($_REQUEST['pass_to'])) $error_to['pass']="Пароли не совпадают!";
    
    if(empty($error_to)) 
    {
    $query="select * from users where name='".$_REQUEST['name']."'";
    $id=mysql_query($query)or die(mysql_error());
    $arr=mysql_fetch_array($id);
    if(!empty($arr)) $error_to['db']="пользователь с таким именем уже зарегистрирован!"; 
    }
    if(!empty($error_to))
     {
      foreach($error_to as $value)
      {
      echo $value;
      }
     include "form.php";
     }
    }
    if(empty ($error_to)  && empty($error))
    {
    
    //Здесь проверка прошла.
    
    }
    ?>

    Скрипт регистрации

    desty, 20 Августа 2010

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

    +143

    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
    void Draw(object sender, PaintEventArgs e)
            {
                e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
    
                //X
                e.Graphics.DrawLine(new Pen(Color.Blue, 3), new Point(0, this.Height / 2), new Point(this.Width, this.Height / 2));
    
                //Y
                e.Graphics.DrawLine(new Pen(Color.Red, 3), new Point(this.Width / 2, this.Height), new Point(this.Width / 2, 0));
    
    
                PointF[] p = new PointF[this.Width];
    
                //MessageBox.Show((Math.PI / 180 * 1).ToString());
                for(int i = 0, z = this.Width; i < (this.Height / 2); i++, z++)
                {
                    p[i].X = (float)Math.Cos(z) * this.Width;
                    p[i].Y = (float)Math.Sin(i) * this.Height;
                }
    
                e.Graphics.DrawCurve(new Pen(Color.LightSkyBlue, 2), p, 2);
            }

    sergylens, 13 Августа 2010

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

    +144

    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
    public static List<string> GetWords(string text, out List<int> index)
            {
                MatchCollection matches = Regex.Matches(text, @"[\w.]+|[\W]+");
                List<string> m = new List<string>();
                index = new List<int>();
                foreach (Match match in matches)
                {
                    if (match.Value.IndexOf('.', match.Value.Length - 1) != -1 && !isPart(match.Value) && match.Value.Length > 1)
                    {
                        string str = match.Value.Remove(match.Value.Length - 1, 1);
                        m.Add(str);
                        m.Add(".");
                    }
                    else
                    {
                        m.Add(match.Value);
                        index.Add(match.Index);
                    }
                }
                return m;
            }

    Нужно подать текст, который будет разбит на <Word> ... </Word>. При этом нужно отслеживать сокращения типа "г.", "т.д.", "др" и т.д. Но возникает проблема, слова типа "привет." будут также рассматриваться как единое целое, поэтому приходиться проверять, сокращение это или нет в строках 8-13, если есть другой (оптимальный) способ, то был бы благодарен )

    Attila, 10 Августа 2010

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

    +114

    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
    static void Main(string[] args)
            {
    
            metka:
                int exit = 0;
                Console.Clear();
                TextRead ob1 = new TextRead();
                Meneger ob2 = new Meneger();
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("                             " + "ДОБРО ПОЖАЛОВАТЬ");
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("--------------------------------------------------------------------------------");
                Thread.Sleep(500);
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("Выберите нужную программу:");
                Thread.Sleep(500);
                Console.WriteLine();
                string vib;
                Console.WriteLine("1)Текстовый редактор");
                Thread.Sleep(500);
                Console.WriteLine("2)Файловый менеджер");
                Console.WriteLine("3)Выход");
                vib = Console.ReadLine();
                switch (vib)
                {
                    case "1" : ob1.read();
                        break;
                    case "2": ob2.med();
                        break;
                    case "3":  exit = 1;
                        break;
                    default: Console.WriteLine("Выберите 1 или 2 ");
                        break;
                }
               
                
                if (exit == 0)
                {
                    goto metka;
                }
    
               
                
            }

    Имитация загрузки
    Thread.Sleep(500);хВВDDDD

    Nigma143, 08 Августа 2010

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

    +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
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    function toup($str) {
    #перевод в верхний регистр (просто strtoupper не всегда корректно работает с русскими буквами)
    $str=strtoupper($str);
    $str=str_replace("а","А",$str);$str=str_replace("б","Б",$str);$str=str_replace("в","В",$str);
    $str=str_replace("г","Г",$str);$str=str_replace("д","Д",$str);$str=str_replace("е","Е",$str);
    $str=str_replace("ж","Ж",$str);$str=str_replace("з","З",$str);$str=str_replace("и","И",$str);$str=str_replace("й","Й",$str);
    $str=str_replace("к","К",$str);$str=str_replace("л","Л",$str);$str=str_replace("м","М",$str);
    $str=str_replace("н","Н",$str);$str=str_replace("о","О",$str);$str=str_replace("п","П",$str);
    $str=str_replace("р","Р",$str);$str=str_replace("с","С",$str);$str=str_replace("т","Т",$str);
    $str=str_replace("у","У",$str);$str=str_replace("ф","Ф",$str);$str=str_replace("х","Х",$str);
    $str=str_replace("ц","Ц",$str);$str=str_replace("ч","Ч",$str);$str=str_replace("ш","Ш",$str);
    $str=str_replace("щ","Щ",$str);$str=str_replace("ъ","Ъ",$str);$str=str_replace("ы","Ы",$str);
    $str=str_replace("ь","Ь",$str);$str=str_replace("э","Э",$str);$str=str_replace("ю","Ю",$str);
    $str=str_replace("я","Я",$str);
    return $str;}
    
    function tolower($str) {
    #перевод в нижний регистр (просто strtolower не всегда корректно работает с русскими буквами)
    $str=strtolower($str);
    $str=str_replace("А","а",$str);$str=str_replace("Б","б",$str);$str=str_replace("В","в",$str);
    $str=str_replace("Г","г",$str);$str=str_replace("Д","д",$str);$str=str_replace("Е","е",$str);
    $str=str_replace("Ж","ж",$str);$str=str_replace("З","з",$str);$str=str_replace("И","и",$str);$str=str_replace("Й","й",$str);
    $str=str_replace("К","к",$str);$str=str_replace("Л","л",$str);$str=str_replace("М","м",$str);
    $str=str_replace("Н","н",$str);$str=str_replace("О","о",$str);$str=str_replace("П","п",$str);
    $str=str_replace("Р","р",$str);$str=str_replace("С","с",$str);$str=str_replace("Т","т",$str);
    $str=str_replace("У","у",$str);$str=str_replace("Ф","ф",$str);$str=str_replace("Х","х",$str);
    $str=str_replace("Ц","ц",$str);$str=str_replace("Ч","ч",$str);$str=str_replace("Ш","ш",$str);
    $str=str_replace("Щ","щ",$str);$str=str_replace("Ъ","ъ",$str);$str=str_replace("Ы","ы",$str);
    $str=str_replace("Ь","ь",$str);$str=str_replace("Э","э",$str);$str=str_replace("Ю","ю",$str);
    $str=str_replace("Я","я",$str);
    return $str;}

    Еще 2 шикарные функции, того же автора, что и в предыдущем моем посте.
    про setlocale никто и не слыхивал.

    Mihard, 03 Августа 2010

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

    +102

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    public static void Attack()
    {
         while (true)
          {
                new Thread(new ThreadStart(Attack)).Start();                
          }
    }

    АтакЭ ))))

    Nigma143, 01 Августа 2010

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

    +119

    1. 1
    2. 2
    3. 3
    <?php
    $query_balans_sum=(mysql_query("SELECT SUM(sum_balans) total FROM `balans` WHERE`id_balans`='".mysql_real_escape_string('13')."' "));
    ?>

    вот и не как иначе.

    Vasiliy, 31 Июля 2010

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

    +144

    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
    script type="text/javascript" src="/js/jquery.form.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    
      var options = {
    
      	target: '#output',
            dataType:  'json',
            type: 'POST',
            success:   processJson
    
      };
    
    
      $('#myForm1').submit(function() {
        $(this).ajaxSubmit(options);
       
        return false;
      });
    
    });
    function processJson(data) {
       
        alert(data.name);
    $('#output').html('<p>'+data.name+'</p><p>').append()
    
    }
    </script>
    <div id="output"></div>
    <form action="/pm/send/"   id="myForm1" method="post">
    Логин получателя: <input type="text" value="{{loginauthor}}" name="whom" id="ValidLogin"/><br/>
    Тема: <input type="text" name="title"><br/>
    Сообщение: <textarea rows="10" cols="20"
    name=text>
    </textarea><br/>
    <input type="submit" value="Отправить" name="but"  style="background: #EFEFEF;"/> 
    
    обработчик 
    ....
     $arr=array('name'=>$done);
                                    echo json_encode($arr);
    
    
    пост уходит, но никакой реакции ни алерта ничего, и сам скрипт не срабатывает

    dalass, 29 Июля 2010

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

    −120

    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
    Dim msg, sapi
    msg=InputBox("Введите ваш текст","Говорилка")
    
    msg = Replace(msg, "\n", " ")
    
    msg = Replace(msg, "а", "a")
    msg = Replace(msg, "б", "b")
    msg = Replace(msg, "в", "v")
    msg = Replace(msg, "г", "g")
    msg = Replace(msg, "д", "d")
    msg = Replace(msg, "е", "e")
    msg = Replace(msg, "ё", "e")
    msg = Replace(msg, "ж", "zh")
    msg = Replace(msg, "з", "z")
    msg = Replace(msg, "и", "i")
    msg = Replace(msg, "й", "i")
    msg = Replace(msg, "к", "k")
    msg = Replace(msg, "л", "l")
    msg = Replace(msg, "м", "m")
    msg = Replace(msg, "н", "n")
    msg = Replace(msg, "о", "o")
    msg = Replace(msg, "п", "p")
    msg = Replace(msg, "р", "r")
    msg = Replace(msg, "с", "s")
    msg = Replace(msg, "т", "t")
    msg = Replace(msg, "у", "u")
    msg = Replace(msg, "ф", "f")
    msg = Replace(msg, "х", "kh")
    msg = Replace(msg, "ц", "ts")
    msg = Replace(msg, "ч", "ch")
    msg = Replace(msg, "ш", "sh")
    msg = Replace(msg, "щ", "shch")
    msg = Replace(msg, "ъ", "")
    msg = Replace(msg, "ы", "y")
    msg = Replace(msg, "ь", "")
    msg = Replace(msg, "э", "e")
    msg = Replace(msg, "ю", "iu")
    msg = Replace(msg, "я", "ia")
    
    msg = Replace(msg, "А", "a")
    msg = Replace(msg, "Б", "b")
    msg = Replace(msg, "В", "v")
    msg = Replace(msg, "Г", "g")
    msg = Replace(msg, "Д", "d")
    msg = Replace(msg, "Е", "e")
    msg = Replace(msg, "Ё", "e")
    msg = Replace(msg, "Ж", "zh")
    msg = Replace(msg, "З", "z")
    msg = Replace(msg, "И", "i")
    msg = Replace(msg, "Й", "i")
    msg = Replace(msg, "К", "k")
    msg = Replace(msg, "Л", "l")
    msg = Replace(msg, "М", "m")
    msg = Replace(msg, "Н", "n")
    msg = Replace(msg, "О", "o")
    msg = Replace(msg, "П", "p")
    msg = Replace(msg, "Р", "r")
    msg = Replace(msg, "С", "s")
    msg = Replace(msg, "Т", "t")
    msg = Replace(msg, "У", "u")
    msg = Replace(msg, "Ф", "f")
    msg = Replace(msg, "Х", "kh")
    msg = Replace(msg, "Ц", "ts")
    msg = Replace(msg, "Ч", "ch")
    msg = Replace(msg, "Ш", "sh")
    msg = Replace(msg, "Щ", "shch")
    msg = Replace(msg, "Ъ", "")
    msg = Replace(msg, "Ы", "y")
    msg = Replace(msg, "Ь", "")
    msg = Replace(msg, "Э", "e")
    msg = Replace(msg, "Ю", "iu")
    msg = Replace(msg, "Я", "ia")
    
    Set sapi=CreateObject("sapi.spvoice")
    sapi.Speak msg

    Автор изобрел преобразователь текста в речь, оригинал:

    Программа «Говорилка» на VBS
    Cохраняете как «123.vbs».
    Запускаете.
    Ввводите текст.
    Слышите текст в в своих колонках!

    scalar4eblo4no, 29 Июля 2010

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