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

    В номинации:
    За время:
  2. Куча / Говнокод #26419

    0

    1. 1
    2. 2
    Гавно, вот нахуя ты удалило мой пост про бабушку и ишака?
    Высеры гостя в упор не видишь, а мои трёшь... Нехорошо.

    Провёл тебе залупой по губам, за такое деяние.

    AnalBoy, 07 Февраля 2020

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    См. что пишут на лОре:
    
    "... на сайте царила приятная атмосфера олдскульности, а контент был не хуже, чем на Хабре. [...]
     неадекватный человек, который много лет спамит и оскорбляет участников. Из -за него а также из-за бездействия админа ушли многие участники и сайт запустел :("

    AnalBoy, 07 Января 2020

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

    0

    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
    <?php
    
    define('MAX_NUMBER', 70);
    
    function factorial($value) {
        return array_reduce(range(1, $value), function($carry,$item){return $carry*$item;}, 1);
    }
    
    function R($value) {
        return floor(2*sqrt(log(($value))));
    }
    
    function make_chain($start, $length) {
        $chain['start'] = $start;
        for($i = 0; $i < $length; ++$i) {
            $hash = factorial($start);
            echo ">>> $start! == $hash\n";            // диагностическое сообщение
            $start = R($hash);
            if($start == 0) break;
        }
        $chain['end'] = $hash;
        echo "Chain from ${chain['start']} to ${chain['end']} is ready.\n"; // диагностическое сообщение
        return $chain;
    }
    
    function make_chains($count, $length) {
        $chains = [];
        mt_srand();
        for($i = 0; $i < $count; ++$i) {
            $number = mt_rand(0, MAX_NUMBER - 1);                // начинаем цепочку с псевдослучайного слова
            $chain = make_chain($number, $length);
            $hash = $chain['end'];                               // используем конец найденной цепочки как индекс для быстрого поиска
            if(!isset($chains[$hash])) $chains[$hash] = [];      // если такого хэша не было в корзине, инициализируем её
            if(!in_array($chain['start'], $chains[$hash])) {     // проверяем на дубли
                $chains[$hash][] = $chain['start'];              // добавляем начало цепочки в корзину
            }
        }
        return $chains;
    }
    
    function find_hash_in_basket($needle, $haystack_start, $haystack_end) {
        echo "Роемся в цепочке от $haystack_start до $haystack_end.\n";       // диагностическое сообщение
        $current_number = $haystack_start;
        do {
            $current_hash = factorial($current_number);         // <-- сюда вставьте нужную хэш-функцию
            if($current_hash <= $needle && $needle <= $current_hash * ($current_number + 1)) {
                 return $current_number;                  // нашли
            }
            $current_number = R($current_hash);  // роем в глубину
        } while($current_hash !== $haystack_end);
        return false; // не нашли
    }
    
    function search_hash($hash, $chains, $length) {
        $current_hash = $hash;
        for($i = 0; $i < $length; ++$i) {
              if(isset($chains[$current_hash])) {                // нашли хэш в одной из корзин
                  echo "Лезем в корзину $current_hash.\n";       // диагностическое сообщение
                  foreach($chains[$current_hash] as $start) {    // роемся в корзине
                      $result = find_hash_in_basket($hash, $start, $current_hash); // пытаемся найти в каждой из цепочек корзины
                      if($result) {
                          return $result;                        // конец поиска
                      }
                  }
              }
              $next_number = R($current_hash);             // копаем в глубину
              $current_hash = factorial($next_number);
        }
        return false; // не нашли
    }
    
    ///////////////////// ПРИМЕР //////////////////////////////////
    
    
    $chains = make_chains(10, 5);
    echo "Радужные таблицы готовы.\n";
    var_dump($chains);
    
    $hash = 721;
    echo "Пытаемся обратить $hash.\n";
    $number = search_hash($hash, $chains, 5);
    echo $number . "! <= $hash <= " . ($number+1) . "!\n";

    Безумная идея: использовать радужные таблицы для обращения математических функций. Например, радужная таблица для факториала:
    http://ideone.com/Q22EXy

    ropuJIJIa, 13 Октября 2019

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

    0

    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
    (set-logic LIA)
    ;(set-option :produce-proofs true)
    
    (define-fun-rec add_via_add1 ((a Int) (b Int)) Int
      (ite (= b 0) a                                ; if (b == 0) return a 
        (ite (< b 0) (- (add_via_add1 (- a) (- b))) ; if (b < 0) return add_via_add(-a,-b)
          (+ (add_via_add1 a (- b 1)) 1)            ; return add_via_add(a, b-1) + 1;
        )
      )
    )
    
    
    (assert
      (not (forall ((a Int) (b Int))
        (= (add_via_add1 a b) (+ a b))
      ))
    )
    
    (check-sat)
    (get-model)
    (exit)

    Хуйня, которую SMT солверы Z3 и CVC4 доказать не могут. Надо переходить на Coq, Metamath, LEAN, Mizar или еще какую-то такую хуйню

    j123123, 15 Сентября 2019

    Комментарии (11)
  6. Python / Говнокод #25818

    +2

    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
    num = 600851475143
    i = 1
    numbers = []
    result = []
    for i in range(1, num):
        if i % 1 == 0:
            if i % i == 0:
                if i % 2 != 0:
                    if i % 3 != 0:
                        if i % 4 != 0:
                            if i % 5 != 0:
                                if i % 6 != 0:
                                    if i % 7 != 0:
                                        if i % 8 != 0:
                                            if i % 9 != 0:
                                                numbers.append(i)
                                                print(numbers)
    
    for c in range (numbers):
        if num % c == 0:
            result.append(c)
    num_2 = max(result)

    Кококой багор )))

    CkpunmoBbIu_nemyx, 09 Сентября 2019

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

    −1

    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
    class Label : System.Windows.Forms.Label {
            public Label ( string s , int x , int y , Form parent ) {
                this.Location = new Point ( x , y ) ;
                this.Text = s ;
                this.AutoSize = true ;
                this.Font = new Font ( SystemFonts.CaptionFont , FontStyle.Bold ) ;
                parent.Controls.Add ( this ) ;
            }
        }
        class Button : System.Windows.Forms.Button {
            public Button ( string s , int x , int y ,  EventHandler f , Form parent ) {
                this.Location = new Point ( x , y ) ;
                this.Text = s ;
                this.Font = new Font ( SystemFonts.CaptionFont , FontStyle.Bold ) ;
                this.Click += f ;
                parent.Controls.Add ( this ) ;
            }
        }
    
        static Form form = new Form() ;
        static Button[,] a = new Button [ 4 , 4 ] ;
        static Random rnd = new Random() ;
        static Timer timer = new Timer() ;
        static Label time = new Label ( "0" , width + cellspacing * 3 , 4 * ( width + cellspacing ) + cellspacing * 2 , form ) ;
        static Label nclicks = new Label ( "0" , 3 * width + cellspacing * 5 , 4 * ( width + cellspacing ) + cellspacing * 2 , form ) ;

    Нашел архив своего старого говна :)

    Pretty_Young_Thing, 03 Сентября 2019

    Комментарии (11)
  8. Си / Говнокод #25791

    −1

    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
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    
    int main(int argc, char *argv[])
    
    {
    
    
    char* line;
    char* start;
    char* dop;
    start=(char*)malloc(10000);
    dop=(char*)malloc(10000);
    start[0]='e';
    start[1]='c';
    start[2]='h';
    start[3]='o';
    start[4]=' ';
    int i=5;
    
    dop[0]=' ';
    dop[1]='|';
    dop[2]=' ';
    dop[3]=' ';
    dop[4]='b';
    dop[5]='c';
    dop[6]=' ';
    dop[7]='-';
    dop[8]='l';
    
    line=(char*)malloc(10000);
    line=argv[1];
    
    while (*line) {*(start+i)=*line;line++;i++;};
    while (*dop){*(start+i)=*dop;dop++;i++;};
    system(start);
    }

    Калькулятор

    killer1804, 01 Сентября 2019

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

    −103

    1. 1
    Меня ограбили

    Я чувствую полнейшее опустошение; в моих яйцах просто вакууууум...

    CnEPMOBOP, 07 Июня 2019

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

    0

    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
    /* Создание базы данных */
    CREATE DATABASE userlistdb;
    
    /* Создание таблицы */
    CREATE TABLE `usertbl` (
    `id` int(11) NOT NULL auto_increment,
    `full_name` varchar(32) collate utf8_unicode_ci NOT NULL default '',
    `email` varchar(32) collate utf8_unicode_ci NOT NULL default '',
    `username` varchar(20) collate utf8_unicode_ci NOT NULL default '',
    `password` varchar(32) collate utf8_unicode_ci NOT NULL default '',
    PRIMARY KEY  (`id`),
    UNIQUE KEY `username` (`username`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
    
    
    <?php
    require("constants.php");
    $connection = mysqli_connect('127.0.0.1', 'root', '', 'userlistdb');
    
    
    if( $connection == false)
    {
        echo 'Не удалось подключиться к базе данных!<br>';
        echo mysqli_connect_error();
        exit();
    }
    	?>
    
    if(isset($_POST["register"])){
    
    
    if(!empty($_POST['full_name']) && !empty($_POST['email']) && !empty($_POST['username']) && !empty($_POST['password'])) {
    	$full_name=$_POST['full_name'];
    	$email=$_POST['email'];
    	$username=$_POST['username'];
    	$password=$_POST['password'];
    	
    	$query = mysql_query ($connection, "SELECT `username`  FROM `usertbl` WHERE `username` ='".$username."'");
    	$numrows=mysql_num_rows($query);
    	
    	if($numrows==0)
    	{
    	$sql="INSERT INTO usertbl
    			(full_name, email, username, password) 
    			VALUES('$full_name','$email', '$username', '$password')";
    
    	$result=mysql_query($sql);
    
    
    	if($result){
    	 $message = "Account Successfully Created";
    	} else {
    	 $message = "Failed to insert data information!";
    	}
    
    	} else {
    	 $message = "That username already exists! Please try another one!";
    	}
    
    } else {
    	 $message = "All fields are required!";
    }
    }
    ?>
    
    
    <?php if (!empty($message)) {echo "<p class=\"error\">" . "MESSAGE: ". $message . "</p>";} ?>
    	
    <div class="container mregister">
    			<div id="login">
    	<h1>REGISTER</h1>
    <form name="registerform" id="registerform" action="register.php" method="post">
    			
    	<p>
    		<label for="user_pass">Username<br />
    		<input type="text" name="username" id="username" class="input" value="" size="20" /></label>
    	</p>
    	
    	<p>
    		<label for="user_pass">Password<br />
    		<input type="password" name="password" id="password" class="input" value="" size="32" /></label>
    	</p>	
    	
    
    		<p class="submit">
    		<input type="submit" name="register" id="register" class="button" value="Register" />
    	</p>
    	
    	<p class="regtext">Already have an account? <a href="login.php" >Login Here</a>!</p>
    </form>

    Подскажите что еи надо, выдаёт эту ошибку
    Неустранимая ошибка : необработанная ошибка: вызов неопределенной функции mysql_query () в C: \ Users \ John \ Desktop \ OSPanel \ domains \ localhost \ phpform \ register.php: 16 Трассировка стека: # 0 {main} выбрасывается в register.php в строке 16

    $query = mysql_query ( "SELECT `username` FROM `usertbl` WHERE `username` ='".$username."'");

    arts, 17 Апреля 2019

    Комментарии (11)
  11. JavaScript / Говнокод #25446

    +1

    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
    // http://pacipfs2.antizapret.prostovpn.org/proxy-ssl.js
    
    function FindProxyForURL(url, host) {
      if (d_ipaddr.length < 10) return "DIRECT"; // list is broken
    
      if (!az_initialized) {
        var prev_ipval = 0;
        for (var i = 0; i < d_ipaddr.length; i++) {
         d_ipaddr[i] = parseInt(d_ipaddr[i], 36) + prev_ipval;
         prev_ipval = d_ipaddr[i];
        }
        for (var i = 0; i < special.length; i++) {
         special[i][1] = nmfc(special[i][1]);
        }
        az_initialized = 1;
      }
    
      var shost;
      if (/\.(ru|co|cu|com|info|net|org|gov|edu|int|mil|biz|pp|ne|msk|spb|nnov|od|in|ho|cc|dn|i|tut|v|dp|sl|ddns|dyndns|livejournal|herokuapp|azurewebsites|cloudfront|ucoz|3dn|nov|linode|amazonaws|sl-reverse|kiev)\.[^.]+$/.test(host))
        shost = host.replace(/(.+)\.([^.]+\.[^.]+\.[^.]+$)/, "$2");
      else
        shost = host.replace(/(.+)\.([^.]+\.[^.]+$)/, "$2");
      // Script optimization, see https://bugs.chromium.org/p/chromium/issues/detail?id=678022
      for (var k in dn) {
        var r = new RegExp('\\.'+k+'$');
        if (r.test(shost)) {shost = shost.replace(r, dn[k]); break;}
      }
      var curarr;
      if (/^[a-d]/.test(shost)) curarr = d_ad;
      else if (/^[e-h]/.test(shost)) curarr = d_eh;
      else if (/^[i-l]/.test(shost)) curarr = d_il;
      else if (/^[m-p]/.test(shost)) curarr = d_mp;
      else if (/^[q-t]/.test(shost)) curarr = d_qt;
      else if (/^[u-z]/.test(shost)) curarr = d_uz;
      else curarr = d_other;
    
      var oip = dnsResolve(host);
      var iphex = "";
      if (oip) {
       iphex = oip.toString().split(".");
       iphex = parseInt(iphex[3]) + parseInt(iphex[2])*256 + parseInt(iphex[1])*65536 + parseInt(iphex[0])*16777216;
      }
      var yip = 0;
      if (iphex) {
       for (var i = 0; i < d_ipaddr.length; i++) {
        if (iphex === d_ipaddr[i]) {yip = 1; break;}
       }
      }
      for (var i = 0; i < curarr.length; i++) {
        if (yip === 1 || shost === curarr[i]) {
          return "HTTPS proxy.antizapret.prostovpn.org:3143; PROXY proxy.antizapret.prostovpn.org:3128; DIRECT";
        }
      }
      for (var i = 0; i < special.length; i++) {
        if (isInNet(oip, special[i][0], special[i][1])) {return "PROXY CCAHIHA.antizapret.prostovpn.org:3128; DIRECT;";}
      }
    
      return "DIRECT";
    }

    CCAHIHA

    j123123, 13 Марта 2019

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