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

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

    +134

    1. 1
    2. 2
    3. 3
    <a target="_self" 
    	href="mx/automation/delegates/advancedDataGrid/package-detail.html" 
    	onclick="javascript:loadClassListFrame('mx/automation/delegates/advancedDataGrid/class-list.html');">

    Форматирование я добавил. Источник, думаю, указывать не нужно :)

    wvxvw, 09 Августа 2011

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

    +159

    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
    #настройка	
    $file = file_get_contents('data/other/addsite.xml');
    $count = 80;	
    
    function getDatabase($name,$file){
    $DATABASE = file_get_contents('database/'.$file.'.dat');
    $DATABASE = explode('|',substr($DATABASE,0,-1));
    foreach($DATABASE as $datavalue){
    $datavalue = explode('==',$datavalue);
    $names = $datavalue[0];
    $value = $datavalue[1];
    $arr["$names"] = $value;
    }
    
    return $arr["$name"];
    }
    
    #обработка
    preg_match_all("/<name>(.+?)<\/name>/",$file,$matches);
    preg_match_all("/comment id\=\"(.+?)\"/",$file,$matchesid);
    
    if(!isset($matches[1]))die('ничего не найдено =(');
    if(!isset($matchesid[1]))die('ничего не найдено =(');
    
    $matchesid = array_reverse($matchesid[1]);
    $matches = array_reverse($matches[1]);
    $urls=array();
    
    foreach($matches as $url){
    	if(!$count)break;
    	$count--;
    
    if(!strpos(' '.$url,'http://')){
    $url = 'http://'.$url;
    }
    
            $parts = parse_url($url);
            if(substr($parts['host'],0,4)=='www.'){
            $purl = substr($parts['host'],4);
            } else {
            $purl = $parts['host'];
            }
    	if(isset($purl)){$urls[] = $purl;}
    	}
    
    $text = '';
    $count2=0;
    
    $ids=array();
    
    $countf=80;
    foreach($matchesid as $id){
    	if(!$countf)break;
    	$countf--;
    	$ids[] = $id;
    }
    
    foreach($urls as $href){
        $count2++;
    
    $idd = $ids["$count2"-1];
    $statuss = getDatabase('uweb'.$idd,'checker');
    
    $statusx = "<img src=\"/data/files/".$statuss.".png\" align=\"absmiddle\" />";
    
    
    	$text.="<span id=\"check$idd\">$statusx</span> <a href='http://$href/' target='_blank' rel='nofollow'>http://$href/</a>".($count2%20==0?'</td><td valign="top" width="25%" align="left">':'<br/>');
    	}
    # вывод
    echo "<table width='100%'><tr><td valign='top' width='25%' align='left'>".$text."</td></tr></table>";

    Студия "раскрутки" сайтов uweb.su

    substr, 06 Августа 2011

    Комментарии (5)
  4. JavaScript / Говнокод #7458

    +158

    1. 1
    2. 2
    3. 3
    A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.
    
    Script: http://govnokod.ru/media/d10c81f141cf62e45d6f8dba139fa72d.js?files=jquery.js,govnokod.js,livecomments.js,jshighlight/highlight.pack.js&v=4:452

    Говнокод в govnokod e.

    yahoo, 05 Августа 2011

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

    +126

    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
    // Get credit spread rates and tenors
    mDtCreditSpreadTenors = aRDO.GetResultTable(mSelectCreditSpreadRates, mCode, mCreditSpreadCurveDate);
    
    // Check if any credit spread rates are returned
    if (mDtCreditSpreadTenors.Rows.Count == 0)
    {
        // If debugging
        if (System.Diagnostics.Debugger.IsAttached)
            // Get from fixed date
            mDtCreditSpreadTenors = aRDO.GetResultTable(mSelectCreditSpreadRates, mCode, 39396);
        else        
            // Add error
            aMissingData.Add(string.Format("Cannot find credit spread rates for date {0}", mCreditSpreadCurveDate.ToShortDateString()));
    }

    Счастливой отладки, суки!

    xxxcoderxxx, 05 Августа 2011

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

    +147

    1. 1
    2. 2
    3. 3
    public static function prepareHTML ($inStr) {
    		return htmlspecialchars(htmlspecialchars_decode($inStr));
    	}

    Sers, 05 Августа 2011

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

    +154

    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
    function get_sql($_POST){
    $fields = file("inc/".$_POST['table'].".fields");
    $id=$_POST['id'];
    
    foreach($fields as $ff){
        $f=explode(" ",strtolower($ff));
        $fn=str_replace("`","",$f[0]);
    
        if($id){
         if($f[0]!='`id`'){
    
            if(strlen($sql)>0){
            if($fn=='del_data'&&$new_data) $sql.=",";
            else if($fn!='del_data') $sql.=",";
            }
    
                if($fn=='del_data'&&$new_data) $sql.=$f[0]."=";
                else if($fn!='del_data')$sql.=$f[0]."=";
    
                    if($_POST[$fn]){
                                   if(strpos($f[1],'archar')) {
                                            if($fn=='pass')$sql.="'".md5(md5($_POST[$fn]).md5('salt'))."'";
                                            else $sql.="'".$_POST[$fn]."'";
                                   }
                                if(strpos($f[1],'loat')) $sql.="'".(floatval(str_replace(",",".",$_POST[$fn]))?floatval(str_replace(",",".",$_POST[$fn])):0)."'";
                                if(strpos($f[1],'nt')) {
                                    if($_POST[$fn]=='on')$sql.="'1'";
                                    else if($fn=='user_id')$sql.="'".$u['id']."'";
                                    else $sql.="'".(intval($_POST[$fn])?intval($_POST[$fn]):0)."'";
                    }
                    if(strpos($f[1],'ate')) {
                            $sql.="'".$_POST[$fn]."'";
                    }
            }
    
            else if($fn=='user_id')$sql.="'".$u['id']."'";
            else if(strpos($f[1],'nt')) $sql.="'0'";
            else if(strpos($f[1],'loat')) $sql.="'0'";
            else if(strpos($f[1],'archar')) $sql.="''";
            else if(strpos($f[1],'ate')) {
    
                if($fn!='del_data') $sql.="'".get_date()."'";
            }
        }
        }
     ////////////////////////////////////////////////////////////////////////////////////////////////////
        else {
            if($f[0]=='`id`')$sql.="NULL";
            else
        {
        if($_POST[$fn]){
           if(strpos($f[1],'archar')) {
                    if($fn=='pass')$sql.=",'".md5(md5($_POST[$fn]).md5('salt'))."'";
                    else $sql.=",'".$_POST[$fn]."'";
           }
           else if(strpos($f[1],'loat')) $sql.=",'".(floatval(str_replace(",",".",$_POST[$fn]))?floatval(str_replace(",",".",$_POST[$fn])):0)."'";
           else if(strpos($f[1],'nt')) {
                if($_POST[$fn]=='on')$sql.=",'1'";
                else $sql.=",'".(intval($_POST[$fn])?intval($_POST[$fn]):0)."'";
            }
           else if(strpos($f[1],'ate')) {
                $sql.=",'".$_POST[$fn]."'";
            }
    
        }
        else if($fn=='user_id')$sql.=",'".$u['id']."'";
        else if(strpos($f[1],'nt')) $sql.=",'0'";
        else if(strpos($f[1],'loat')) $sql.=",'0'";
        else if(strpos($f[1],'archar')) $sql.=",''";
        else if(strpos($f[1],'ate')) {
                if($fn!='del_data') $sql.=",'".get_date()."'";
        }
        }
        }
    
    }
    if(!$id)$sql="insert into `".$_POST['table']."` values(".$sql.")";
    else $sql="update  `".$_POST['table']."` set ".$sql." where `id`='$id'";
    
    $ok=get_mysql_result($sql);
     return $ok;
    }

    Стыдно, но нашел это в одном из первых проектов... :S

    coderov, 02 Августа 2011

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

    +242

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    proc HeapCompact(HANDLE hHeap, DWORD dwFlags)
    	mov     edi, edi
    	push    ebp
    	mov     ebp, esp
    	pop     ebp
    	jmp     RtlCompactHeap
    endp

    Код от Microsoft. Заглушка? А вот и нет! Для заглушки нужны 5 байтов, а pop ebp останется на месте, т.е. при вызове вершина стека нарушится. Вот не могли просто NOP написать...

    KIRK, 29 Июля 2011

    Комментарии (5)
  9. Python / Говнокод #7372

    −97

    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
    if cells[x-1,y-1] == 1: pos+=1
    else:
      if cells[x-1,y-1] == -1: neg+=1
    if cells[x-1,y] == 1: pos+=1
    else:
      if cells[x-1,y] == -1: neg+=1
    if cells[x-1,y+1] == 1: pos+=1
    else:
      if cells[x-1,y+1] == -1: neg+=1
    
    if cells[x,y-1] == 1: pos+=1
    else:
      if cells[x,y-1] == -1: neg+=1
    if cells[x,y] == 1: pos+=1
    else:
      if cells[x,y] == -1: neg+=1
    if cells[x,y+1] == 1: pos+=1
    else:
      if cells[x,y+1] == -1: neg+=1
    
    if cells[x+1,y-1] == 1: pos+=1
    else:
      if cells[x+1,y-1] == -1: neg+=1
    if cells[x+1,y] == 1: pos+=1
    else:
      if cells[x+1,y] == -1: neg+=1
    if cells[x+1,y+1] == 1: pos+=1
    else:
      if cells[x+1,y+1] == -1: neg+=1

    Иначе никак =D.

    Fai, 28 Июля 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    if (!$case['item_type'])
            unset($case['item_type']);
    else
            unset($case['content_id']);

    sectronov, 28 Июля 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    protected void btn_cancel_Click(object sender, EventArgs e)
    {
                string dumpurl = url;
                url = string.Empty;
                Response.Redirect(dumpurl);
    }

    ASP.NET: кнопка cancel на форме.
    string url - филд формы.

    musuk, 28 Июля 2011

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