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

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

    +163.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    $true = true;
    for ($i=0; $i<count($list); $i++)
      if (!isset($list[$i]))
       $true = false;
    
    if ($true != true)
      die ("Error");

    Немного о правде и лжи

    GreenSid, 11 Августа 2009

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

    +147.6

    1. 1
    2. 2
    $false = false;
    return $false;

    В Jooml'е встретил нашел такой кусок

    guest, 05 Августа 2009

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

    +97.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    int main()
    {
        ...
        return rand();
    }

    Иногда даже вылетают ошибки!

    guest, 28 Июля 2009

    Комментарии (8)
  5. Pascal / Говнокод #1408

    +128.5

    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
    program kot;
    
    var r,i,j, z : integer ;
     famnom: array[1..11,1..26] of char;
    Label lb1, lb2;
    
        begin
    
    Assign(input, 'c:\pascal\kot.txt');
    Reset(input);
     Assign(output, 'c:\pascal\tok.txt');
    Rewrite(output);
    for j:=1 to 10 do
    for i:=1 to 26 do           (*каждому символу присваивается свой номер в массиве*)
    
     begin
     read(input,famnom[j,i]);
     write(famnom[j,i]);        (*исходные данные копируются в файл*)
     end;
    
    writeln('');
    writeln('');
    close(input);
    
    Assign(input, 'c:\pascal\kot.txt');
    Reset(input);
    begin
    
    
    lb1 :   for j:=1 to 10 do
    begin
          i:= 16;                            
    while famnom[j,i]=famnom[j+1,i] do      
    i:=i+1;                               (*блабла*)
    if  famnom[j,i]<famnom[j+1,i] then    
    begin
    for i := 1 to 26 do
    begin
    famnom[11,i]:=famnom[j,i];            (*сравниваются символы короч*)
    famnom[j,i]:=famnom[j+1,i];
    famnom[j+1,i]:=famnom[11,i];
    
    
    end;
    goto lb1;
    end;
    end;
    end;
    
    for j:=1 to 10 do                
    for i:= 1 to 26 do
    begin
    write(famnom[j,i]);
    
    end;
    close(input);
    close(output);
    end.

    Ужас какойто

    guest, 23 Июля 2009

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

    +140

    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
    char *bukva="qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
    char *cifra="1234567890";
    
    //тут получаем строку
    
    while((ch = getc(fp)) != EOF) {
        putc(ch,stdout);
        if(ch == ' ') {probel++; continue;}
        for (j = 0; j < (strlen(cifra)); j++) {
            if(ch == cifra[j])
                countcifra++;
        }
    
        for (j = 0;j < (strlen(bukva)); j++) {
            if(ch == bukva[j])
                countbukva++;
        }
     }

    Из лабораторки однокурсника. Подсчет количества букв и цифр в строке

    guest, 23 Июля 2009

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

    +185

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    define('KEY', md5('Obama'));
    
    if($_GET['key'] != KEY) { 
    ...
    }

    таки обамосекьюрность))
    встретилось в одном большом проекте, который успешно работает и процветает по сей день

    guest, 08 Июля 2009

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

    +138.2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if(true)
    {
      //Код
    }
    else
    {
      //Закомментированно, но компилируется. ^_^
    };

    Способ комментирования... O_o

    guest, 03 Июля 2009

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

    +84

    1. 1
    2. 2
    3. 3
    char* c=a;
    char* d=b;
    while(*(c++)=*(d++));

    Кажется страус труп предложил. Копирование из буфера PChar b в буфер PChar a.

    guest, 28 Июня 2009

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

    +153

    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
    95. 95
    96. 96
    97. 97
    <?
    ob_start();
    session_start();
    include("includes/applicationTop.php");
    ?>
    <?
    if($_SESSION["CONTACT_ID"]=="" || $_SESSION["CONTACT_ID"]==0)
    {
    	$contact_id=$_GET['contact_id'];
    }
    else
    {
    	$contact_id = $_SESSION["CONTACT_ID"];
    }
    if($_SESSION["ORDER_ID"]=="" || $_SESSION["ORDER_ID"]==0)
    {
    	$order_id=$_GET['order_id'];
    }
    else
    {
    	$order_id = $_SESSION["ORDER_ID"];
    }
    
    $selBillingInfo = "SELECT * FROM `contact` WHERE `contact_id`='".$contact_id."'";
    $resBillingInfo = $db->select_data($selBillingInfo);
    $selOrderInfo = "SELECT * FROM `order` WHERE `order_id`='".$order_id."'";
    $resOrderInfo = $db->select_data($selOrderInfo);
    ?>
    <? $exesql=mysql_query("select * from admin_updation where id = 1"); 
    $rs=mysql_fetch_object($exesql); $to_mail=$rs->paypal_id;?> 
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
    	<td width="30"><img src="images/spacer.gif" width="30" height="1" /></td>
    	<td><form class="formclass" method="post" action="https://www.paypal.com/cgi-bin/webscr"  id="myform" name="theForm" ><!--<form class="formclass" method="post" action="https://www.paypal.com/cgi-bin/webscr"  id="myform" name="theForm" >-->
    		<input name="validate" value="1" type="hidden">
    		<input type="hidden" name="order_id" value="<?=$order_id?>" />
    		<?
    		$paypal[site_url]="http://говносайт";
    		$paypal[success_url]="/paymentReceipt.php?success=paypal&pt=paypal&contact_id=$contact_id&order_id=$order_id";
    		$paypal[cancel_url]="/paymentReceipt.php?success=failed&pt=paypal&contact_id=$contact_id&order_id=$order_id";
    		$paypal[notify_url]="/ipn/ipn.php";
    		$paypal[return_method]="2"; //1=GET 2=POST
    		$paypal[currency_code]="USD"; //[USD,GBP,JPY,CAD,EUR]
    		$paypal[lc]="US";
    		$paypal[url]="https://www.sandbox.paypal.com/cgi-bin/webscr"; // For Test 
    		$paypal[post_method]="fso"; //fso=fsockopen(); curl=curl command line libCurl=php compiled with libCurl support
    		$paypal[curl_location]="/usr/local/bin/curl";
    		$paypal[bn]="toolkit-php";
    		$paypal[cmd]="_xclick";
    		$paypal[display_comment]="0"; //0=yes 1=no
    		$paypal[comment_header]="Comments";
    		$paypal[continue_button_text]="Continue >>";
    		$paypal[background_color]="1"; //""=white 1=black
    		$paypal[display_shipping_address]="1"; //""=yes 1=no
    		$paypal[display_comment]="1"; //""=yes 1=no
    		?>
    		<!--<input type="hidden" name="business" value="[email protected]">--><? // For Live ?>
    		
    		<input type="hidden" name="business" value="<?=$to_mail?>"><? // For Test ?>
    		<!--<input type="hidden" name="business" value="[email protected]">--><? // For Test ?>
    		<input type="hidden" name="item_name" value="Говнобрэнд">
    		<input type="hidden" name="cmd" value="<?=$paypal[cmd]?>">
    		<input type="hidden" name="redirect_cmd" value="<?=$paypal[cmd]?>">
    		<input type="hidden" name="image_url" value="">
    		<input type="hidden" name="return" value="<? echo "$paypal[site_url]$paypal[success_url]"; ?>">
    		<input type="hidden" name="cancel_return" value="<? echo "$paypal[site_url]$paypal[cancel_url]"; ?>">
    		<input type="hidden" name="notify_url" value="<? echo "$paypal[site_url]$paypal[notify_url]"; ?>">
    		<input type="hidden" name="rm" value="<?=$paypal[return_method]?>">
    		<input type="hidden" name="currency_code" value="<?=$paypal[currency_code]?>">
    		<input type="hidden" name="lc" value="<?=$paypal[lc]?>"><input type="hidden" name="bn" value="<?=$paypal[bn]?>">
    		<input type="hidden" name="cbt" value="<?=$paypal[continue_button_text]?>"><input type="hidden" name="no_shipping" value="<?=$paypal[display_shipping_address]?>">
    		<input type="hidden" name="no_note" value="<?=$paypal[display_comment]?>">
    		<input type="hidden" name="order_id" value="<?=$order_id?>"><input type="hidden" name="amount" value="<?=$resOrderInfo[0]['amount']?>">
    		<input type="hidden" name="first_name" value="<?=$resBillingInfo[0]['first_name']?>">	<input type="hidden" name="last_name" value="<?=$resBillingInfo[0]['last_name']?>">
    		<input type="hidden" name="company" value="<?=$resBillingInfo[0]['company']?>"><input type="hidden" name="address" value="<?=$resBillingInfo[0]['address']?>">
    		<input type="hidden" name="city" value="<?=$resBillingInfo[0]['city']?>"><input type="hidden" name="state" value="<?=$resBillingInfo[0]['state']?>">
    		<input type="hidden" name="zip" value="<?=$resBillingInfo[0]['zip']?>">
    		<input type="hidden" name="country" value="<?=$resBillingInfo[0]['country']?>">
    		<input type="hidden" name="phone" value="<?=$resBillingInfo[0]['phone']?>"> 	<input type="hidden" name="email " value="<?=$resBillingInfo[0]['email']?>">	<input type="hidden" name="a3" value="<?=$resOrderInfo[0]['amount']?>">
    		<input type="hidden" name="p3" value="1">	<input type="hidden" name="t3" value="M"> <input type="hidden" name="no_note" value="1">
    		<input type="hidden" name="src" value="1"><input type="hidden" name="sra" value="1">
    		<table width="100%" border="0" cellspacing="0" cellpadding="0">
    		  <tr>
    			<td class="text_body">&nbsp;</td>
    		  </tr>
    		  <tr>
    			<td align="left"></td>
    		  </tr>
    		</table>
    	  </form></td>
    	<td width="15"><img src="images/spacer.gif" width="15" height="1" /></td>
      </tr>
    </table>
    <script language="JavaScript">
    objfrm = document.getElementById("myform");
    objfrm.submit();
    </script>

    А вот занятный способ переброса посетителя на paypal.
    С помощью невидимой формы, который сама засабмитится (может быть).

    Источник тот же, что у #1244-#1245, #1248-#1250

    guest, 25 Июня 2009

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

    +46.7

    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
    $t = new Table('foo');
    $t->th('Header 1');
    $t->th('Header 2');
    $t->th('Header 3');
    $t->endRow();
    for($i = 0; $i<10; $i++) {
    $t->td('Cell 1');
    $t->td('Cell <2>', '', true);
    $t->td('Cell 3');
    $t->endRow();
    }
    $t->end();
    
    На выходе получаем html таблицы...

    Вот так крутые пацаны понимают термин OOP,
    http://habrahabr.ru/sandbox/3112/ человек хочет за изобретение инвайт, ссылка по видимому умрет, так что инвайт дарите быстрее, если шедевр вас тронул :)

    guest, 19 Июня 2009

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