1. 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)
  2. 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)
  3. PHP / Говнокод #1923

    +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
    $start=microtime(true);
    for($i=0;$i>1000;$i++)
    {
    $id = intval($_GET['id']);
    }
    $end=microtime(true);
    $total1=$end-$start;
    
    
    $start=microtime(true);
    for($i=0;$i>1000;$i++)
    {
    $id = (int) $_GET['id'];
    }
    $end=microtime(true);
    $total2=$end-$start;
    
    
    echo '<br>---------------------------------------------------------------------------------------<br>';
    
    echo "intval = $total1 <br> int = $total2"

    LOL

    anycolor, 30 Сентября 2009

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

    +146.1

    1. 1
    function move($oldname, $newname, $context=null) { retrurn rename($oldname, $newname, $context); }

    greevex, 30 Сентября 2009

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

    +166.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
    /*....*/
     $info = ldap_get_entries($ds, $sr);
    
     $Number=0;
     for ($i=0; $i<$info["count"]; $i++) {$Number++;}
    
     for ($i=0; $i<$Number; $i++)
     {
      if (!($info[$i]["cn"] == ""))
      {
       $user=$info[$i]["cn"][0];
       echo $user."\n";
      }
     }
     /*....*/

    vugluskr, 30 Сентября 2009

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

    +151.9

    1. 1
    if ($startTime == $endTime || $endTime < $startTime) {

    Написал, ужаснулся и тут же переписал

    striker, 30 Сентября 2009

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

    +132

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <?php
    
    echo "If you see this then PHP works fine!";
    
    ?>

    Проверка работоспособности интерпретатора PHP.

    XPSystemServices, 29 Сентября 2009

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

    +144.3

    1. 1
    2. 2
    if(preg_match("/^((https?\:\/\/)?([a-z0-9]+\-*[a-z0-9]+)+\.)+[a-z0-9]{2,7}(\:[0-9]{1,4})?$/i", $_GET['url'])) print 'тута пля не ерор !';
    else{print 'неверный url';}

    no comments :D

    greevex, 29 Сентября 2009

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

    +170.4

    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
    98. 98
    <?php
    $mm=strlen( $titLE);
    $tit='';   
    for ($i=0;$i<=$mm;$i++)
    {
    $ss= $titLE[$i];
    switch ($ss) 
    {
    case "щ": $tit= $tit."sch";  break;
    case "ч": $tit= $tit."ch";  break;
    case "ш": $tit= $tit."sh";  break; 
    case "я": $tit= $tit."ja";  break;
    case "ю": $tit= $tit."ju";  break;
    case "ё": $tit= $tit."jo";  break;
    case "ж": $tit= $tit."zh";  break;
    case "э": $tit= $tit."e";  break;
    case "Щ": $tit= $tit."Sch";  break; 
     case "Ч": $tit= $tit."Ch";  break;
     case "Ш": $tit= $tit."Sh";  break;
     case "Я": $tit= $tit."Ja";  break;
    case "Ю": $tit= $tit."Ju";  break;
    case "Ё": $tit= $tit."Jo";  break; 
    case "Ж": $tit= $tit."Zh";  break;
    case "Э": $tit= $tit."E";  break;
    case "ь": $tit= $tit."";  break; 
    case "ъ": $tit= $tit."'";  break; 
    case "а": $tit= $tit."a";  break;
     case "б": $tit= $tit."b";  break;
    case "ц": $tit= $tit."c";  break;
    case "д": $tit= $tit."d";  break;
    case "е": $tit= $tit."e";  break; 
    case "ф": $tit= $tit."f";  break; 
    case "г": $tit= $tit."g";  break;
    case "х": $tit= $tit."h";  break; 
    case "и": $tit= $tit."i";  break; 
    case "й": $tit= $tit."j";  break;
    case "к":
         {
    
            if ($str[$i+1]=="с" ) {
            $tit= $tit."x";  
           $i=$i+1; break;}
             $tit= $tit."k";  break;
           }
    case "л": $tit= $tit."l";  break;
    case "м": $tit= $tit."m";  break;
    case "н": $tit= $tit."n";  break;
    case "о": $tit= $tit."o";  break;
    case "п": $tit= $tit."p";  break; 
    case "р": $tit= $tit."r";  break; 
    case "с": $tit= $tit."s";  break;
    case "т": $tit= $tit."t";  break;
    case "у": $tit= $tit."u";  break;
    case "в": $tit= $tit."v";  break;
    case "ы": $tit= $tit."y";  break;
    case "з": $tit= $tit."z";  break; 
    case "Ь": $tit= $tit."'";  break;
    case "Ъ": $tit= $tit."'";  break;
    case "А": $tit= $tit."A";  break;
    case "Б": $tit= $tit."B";  break; 
    case "Ц": $tit= $tit."C";  break;
    case "Д": $tit= $tit."D";  break;
     case "Е": $tit= $tit."E";  break;
    case "Ф": $tit= $tit."F";  break;
    case "Г": $tit= $tit."G";  break;
    case "Х": $tit= $tit."H";  break;
    case "И": $tit= $tit."I";  break;
    case "Й": $tit= $tit."J";  break;
    case "К":    
         {
          if ($str[$i+1]=="С" ) {
            $tit= $tit."X";  
           $i=$i+1; break;}
    
          if ($str[$i+1]=="с" ) {
            $tit= $tit."X";  
           $i=$i+1; break;}
    
           $tit= $tit."K"; break;
           }
    case "Л": $tit= $tit."L";  break;
     case "М": $tit= $tit."M";  break;
    case "Н": $tit= $tit."N";  break;
    case "О": $tit= $tit."O";  break;
    case "П": $tit= $tit."P";  break;  
    case "Р": $tit= $tit."R";  break;
    case "С": $tit= $tit."S";  break;
    case "Т": $tit= $tit."T";  break; 
     case "У": $tit= $tit."U";  break; 
     case "В": $tit= $tit."V";  break;
    case "Ы": $tit= $tit."Y";  break;
    case "З": $tit= $tit."Z";  break;
    case " ": $tit= $tit." ";  break;
    default:
            $end1= $tit;
      }
    }
    ?>

    транслитизатор!!!!!!!

    yamaha252, 29 Сентября 2009

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

    +153.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
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    /**
    	* Выполняет запрос SELECT
    	*
    	* @param string  $tables      Список таблиц, разделённый запятыми
    	* @param string  $condition   Условие для выборки (WHERE)
    	* @param string  $order       Поля для сортировки (ORDER BY)
    	* @param string  $fields      Список полей для получения
    	* @param int     $lim_rows    Максимльное количество получаемых записей
    	* @param int     $lim_offset  Начальное смещение для выборки
    	* @param string  $group       Поле для группировки
    	* @param bool    $distinct    Вернуть только уникальные записи
    	*
    	* @return array
    	*/
    	function select($tables, $condition = '', $order = '', $fields = '', $lim_rows = 0, $lim_offset = 0, $group = '', $distinct = false)
    	{
    		if (is_bool($fields) || $fields == '1' || $fields == '0' || !is_numeric($lim_rows)) {
    			# Обратная совместимость c 1.2.x
    			$desc = $fields;
    			$fields = $lim_rows ? $lim_rows : '*';
    			$lim_rows = $lim_offset;
    			$lim_offset = $group;
    			$group = $distinct;
    			$distinct = func_num_args() == 9 ? func_get_arg(8) : false;
    			$query = 'SELECT ';
    			if ($distinct) $query .= 'DISTINCT ';
    			if (!strlen($fields)) $fields = '*';
    			$tables = str_replace('`' ,'', $tables);
    			$tables = preg_replace('/([\w.]+)/i', '`'.$this->prefix.'$1`', $tables);
    			$query .= $fields." FROM ".$tables;
    			if (strlen($condition)) $query .= " WHERE $condition";
    			if (strlen($group)) $query .= " GROUP BY $group";
    			if (strlen($order)) {
    				$query .= " ORDER BY $order";
    				if ($desc) $query .= ' DESC';
    			}
    			if ($lim_rows) {
    				$query .= ' LIMIT ';
    				if ($lim_offset) $query .= "$lim_offset, ";
    				$query .= $lim_rows;
    			}
    		} else {
    			$query = 'SELECT ';
    			if ($distinct) $query .= 'DISTINCT ';
    			if (!strlen($fields)) $fields = '*';
    			$tables = str_replace('`','',$tables);
    			$tables = preg_replace('/([\w.]+)/i', '`'.$this->prefix.'$1`', $tables);
    			$query .= $fields." FROM ".$tables;
    			if (strlen($condition)) $query .= " WHERE ".$condition;
    			if (strlen($group)) $query .= " GROUP BY ".$group."";
    			if (strlen($order)) {
    				$order = explode(',', $order);
    				for($i = 0; $i < count($order); $i++) switch ($order[$i]{0}) {
    					case '+': $order[$i] = substr($order[$i], 1); break;
    					case '-': $order[$i] = substr($order[$i], 1).' DESC'; break;
    				}
    				$query .= " ORDER BY ".implode(', ',$order);
    			}
    			if ($lim_rows) {
    				$query .= ' LIMIT ';
    				if ($lim_offset) $query .= "$lim_offset, ";
    				$query .= $lim_rows;
    			}
    		}
    		$result = $this->query_array($query);
    
    		return $result;
    	}

    nbyt, 28 Сентября 2009

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