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

    +167.4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    $notch_notch_submit = $_POST['submit'];
    $notch_notch_adm_login = $_POST['adm_login'];
    $notch_notch_adm_pass = $_POST['adm_pass'];
    
    $notch_submit = htmlspecialchars($notch_notch_submit); 
    $notch_adm_login = htmlspecialchars($notch_notch_adm_login); 
    $notch_adm_pass = htmlspecialchars($notch_notch_adm_pass);
    
    $submit = strip_tags($notch_submit);
    $adm_login = strip_tags($notch_adm_login);
    $adm_pass = strip_tags($notch_adm_pass);

    Суперзащита о_О

    hiah, 03 Октября 2009

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

    +170.6

    1. 1
    2. 2
    3. 3
    $s = md5('1') . '<br />';
        echo md5('2' . $s) . '<br />';
        echo md5('2' . md5('1')) . '<br />';

    Программист пришёл с жалобой на то что получаются разные значения. =)

    qbel, 03 Октября 2009

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

    +61.9

    1. 1
    2. 2
    3. 3
    std::string strFullMapName;
    if ( strstr( _strMapFileName.c_str(), "Map/" ) != _strMapFileName.c_str() )
    	strFullMapName = "Map/";

    из одного очень дорогого проекта

    pushkoff, 03 Октября 2009

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

    +153.3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    function catGetCategoryById($categoryID)
    {
    	$categoryID = (int)$categoryID;
    	$q = db_query("select categoryID, name, parent, products_count, description, picture, ".
    		" products_count_admin, sort_order, viewed_times".
    		", allow_products_comparison".
    		", allow_products_search".
    		", show_subcategories_products, meta_description, meta_keywords ".
    		"  from ".CATEGORIES_TABLE.
    		" where categoryID=$categoryID");
    	return db_fetch_row($q);
    }

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

    gorky, 03 Октября 2009

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

    +171.8

    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
    <? $page = $_REQUEST['page']; 
    switch ($page) {
    	case news:
    		include "./pages/news.php";
    		break;
    	case about:
    		include "./pages/about.php";
    		break;
    	case about_1:
    		include "./pages/about_1.php";
    		break;
    	case about_2:
    		include "./pages/about_2.php";
    		break;
    	case about_3:
    		include "./pages/about_3.php";
    		break;
    	case how:
    		include "./pages/how.php";
    		break;
    	case admission:
    		include "./pages/admission.php";
    		break;
    	case admission2009:
    		include "./pages/admission2009.php";
    		break;
    	case admission2009_1:
    		include "./pages/admission2009_1.php";
    		break;
    	case admission2009_2:
    		include "./pages/admission2009_2.php";
    		break;
    	case admission2009_3:
    		include "./pages/admission2009_3.php";
    		break;
    	case admission2009_4:
    		include "./pages/admission2009_4.php";
    		break;
    	case admission2009_5:
    		include "./pages/admission2009_5.php";
    		break;
    	case admission2009_6:
    		include "./pages/admission2009_6.php";
    		break;
    	case admission2009_7:
    		include "./pages/admission2009_7.php";
    		break;
    	case admission2009_8:
    		include "./pages/admission2009_8.php";
    		break;
    	case admission2009_10:
    		include "./pages/admission2009_10.php";
    		break;
    	case admission2009_11:
    		include "./pages/admission2009_11.php";
    		break;
    	case programme:
    		include "./pages/programme.php";
    		break; 
    	case programme_1:
    		include "./pages/programme_1.php";
    		break; 
    	case programme_2:
    		include "./pages/programme_2.php";
    		break; 
    	case programme_3:
    		include "./pages/programme_3.php";
    		break; 
    	case vacancy:
    		include "./pages/vacancy.php";
    		break;
    	case donation:
    		include "./pages/donation.php";
    		break;
    	case profile: 
    		include "./profile/index.php";
    		break;
    	case guestbook:
    		echo "<div class='GBlock'>";
    		echo "<h1>Гостевая книга</h1>";
    		include "./guestbook/index.php";
    		echo "</div>";
    		$pagename="Гостевая книга";
    		break;
    	case links:
    		include "./pages/links.php";
    		break;
    	case contacts:
    		include "./pages/contacts.php";
    		break;
    	case upload:
    		include "./profile/upload.php";
    		break;
    	default:
    		include "./pages/404.php";
    		break;
    } ?>

    iGorash, 02 Октября 2009

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

    +137.3

    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
    private ArrayList GetSubscribers(string condition)
            {
               ArrayList subscribers = new ArrayList();
               ArrayList lst =  new user_category_notification().Factory.GetItems(condition, "user_category_notification.id_user");
                ArrayList distinc_lst = new ArrayList();
                ArrayList distinc_lst_ids = new ArrayList();
                ArrayList lst_ids = new ArrayList();
                for (int i = 0; i < lst.Count; i++)
                {
                    lst_ids.Add(((user_category_notification) lst[i]).id_user);
                }
                for (int i = 0; i < lst_ids.Count;i++ )
                {
                    if (distinc_lst_ids.Contains(lst_ids[i])) continue;
                    else
                    {
                        distinc_lst.Add(lst[i]);
                        distinc_lst_ids.Add(lst_ids[i]);
                    }
                }
                foreach (user_category_notification _un in distinc_lst)
                {
                    user _current = (user)new user().Factory.GetByID(_un.id_user);
                    subscribers.Add(_current);
                }
                
                return subscribers;
            }

    Филтрация :)

    bugotrep, 02 Октября 2009

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

    +77

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    if ((!getUserSession().getKodUser().equalsIgnoreCase("0")) &&
            (!getUserSession().getKodUser().equalsIgnoreCase("0")))
    16:33
        // проверка на регистрацию пользователя в системе
        //--------------------------------------------------------------------------------------
        Long userKod;
        if ((!getUserSession().getKodUser().equalsIgnoreCase("0")) &&
            (!getUserSession().getKodUser().equalsIgnoreCase("0")))
        {
          userKod = Long.parseLong(CalcUtil.getUserSession().getKodUser());
          Iterator itUser =
            getUserSession().getAsuEjb().findSpUserByKodUser(userKod).iterator();

    Увидел у одного человека.

    lexx, 02 Октября 2009

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

    +165.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
    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
    function cryptCCNumberDeCrypt( $cifer, $key )
    {
    	return base64_decode($cifer);
    /*
    	$res = "";
    	$strlen = (int)($cifer[0]);
    
    	$dWordArray = array();
    	for( $i=1; $i<=8; $i++ )
    	{
    		$dWordObject = DWord();
    		$dWordObject->SetValue(
    				$cifer[ ($i-1)*4 + 1 ],
    				$cifer[ ($i-1)*4 + 2 ],
    				$cifer[ ($i-1)*4 + 3 ],
    				$cifer[ ($i-1)*4 + 4 ] );
    		$dWordArray[] = $dWordObject;
    	}
    
    	$dWordArrayDeCifered = array();
    	for( $i=1; $i<=4; $i++ )
    	{
    		$deCiferedData = _gostDeCrypt( array( $dWordArray[($i-1)*2], $dWordArray[($i-1)*2 + 1]), $key );
    		$dWordArrayCifered[] = $deCiferedData[0];
    		$dWordArrayCifered[] = $deCiferedData[1];
    	}
    
    	foreach( $dWordArrayCifered as $dWordCifered )
    	{
    		$byte1 = 0;
    		$byte2 = 0;
    		$byte3 = 0;
    		$byte4 = 0;
    		$dWordCifered->GetValue( &$byte1, &$byte2, &$byte3, &$byte4 );
    		$res .= chr($byte1);
    		$res .= chr($byte2);
    		$res .= chr($byte3);
    		$res .= chr($byte4);
    	}
    
    	$temp = $res;
    	for( $i=1; $i<=$strlen; $i++ )
    		$res .= $temp[$i-1];
    		
    	return $res;
    */
    }
    
    // *****************************************************************************
    // Purpose	encrypts cc_expires field ( see ORDERS_TABLE in database_structure.xml )
    // Inputs   	
    // Remarks	
    // Returns	
    function cryptCCHoldernameCrypt( $cc_holdername, $key )
    {
    	return base64_encode( $cc_holdername );
    }	
    function cryptCCHoldernameDeCrypt( $cifer, $key )
    {
    	return base64_decode( $cifer );
    }
    function cryptCCExpiresCrypt( $cc_expires, $key )
    {
    	return base64_encode( $cc_expires );
    }
    function cryptCCExpiresDeCrypt( $cifer, $key )
    {
    	return base64_decode( $cifer );
    }
    function cryptPasswordCrypt( $password, $key )
    {
    	return base64_encode( $password );
    }
    function cryptPasswordDeCrypt( $cifer, $key )
    {
    	return base64_decode( $cifer );
    }
    function cryptFileParamCrypt( $getFileParam, $key )
    {
    	return base64_encode( $getFileParam );
    }	
    function cryptFileParamDeCrypt( $cifer, $key )
    {
    	return base64_decode( $cifer );
    }

    продолжает радовать Shop-Script PREMIUM от WebAsyst LLC.
    перед каждой функцией - комментарий как перед cryptCCHoldernameCrypt() (все просто не влезало)

    gorky, 01 Октября 2009

    Комментарии (6)
  9. bash / Говнокод #1925

    −137.9

    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
    USER_AGENT='Opera/9.80 (X11; Linux i686; U; ru) Presto/2.2.15 Version/10.00';
    ICQ_UIN=$1;
    
    #VAR=`curl --silent --user-agent -v "$USER_AGENT" -d "uin=$ICQ_UIN" http://kanicq.ru/invisible/m/ | grep "Error" | sed 's/<[\/]*[p|b]*>//g' | sed 's/ <img.*>//g'`;
    
    VAR=`curl --silent --user-agent "$USER_AGENT" -d "uin=$ICQ_UIN" http://kanicq.ru/invisible/m/`;
    
    if echo "$VAR" | grep -q Error
    then
    	echo "${c_h_blue}нас забанили";
    else 
    	if echo "$VAR" | grep -q Result
    	then
    		echo `echo $VAR | sed 's/<[\/]*[p|b]*>//g' | sed 's/ <img.*>//g'`;
    	fi
    fi

    особенно доставляет 15 строка, ну не знал как сделать)

    DrFreez, 01 Октября 2009

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

    +54.4

    1. 1
    2. 2
    ConfigEntry::Ptr generateConfigEntry (const QVariant &val);
    QVariant genetateQVariant(const ConfigEntry::Ptr& entry);

    Страшно представить, и эта опечатка месяц пролежала в основном дереве исходников, хорошо хоть приватная функция

    Sauron, 01 Октября 2009

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