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

    +167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if( $user_id < 0 )
        die( "I don't know you!" );
    
    if( $action == '' )
        die( "I don't know, what you want!" );
    
    if( $action == 'login' )
        die();

    rat4, 11 Декабря 2010

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

    +178

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    function verifyQuery($sql, $con) {
        if (!mysql_query($sql, $con)) {
            echo "Error occured in verifyQuery() in sqlfunctions.php <br>";
            echo "SQL sent : ";
            echo $sql;
            echo "<br>Database report: <br>";
            die('Error: ' . mysql_error());
        }
        return mysql_query($sql, $con);
    }

    fork, 11 Декабря 2010

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

    +162

    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
    //__________________________________
    $id = $_POST['id']; 
    $fio = $_POST['fio']; 
    $adres = $_POST['adres']; 
    $pom = $_POST['pom']; 
    $s = $_POST['s']; 
    $data_dog = $_POST['data_dog']; 
    $stady = $_POST['stady']; 
    $prolоnga = $_POST['prolonga']; 
    $data = $_POST['data']; 
    $data_over = $_POST['data_over']; 
    $hows = $_POST['hows']; 
    $etazh = $_POST['etazh']; 
    $otn = $_POST['otn']; 
    $svid = $_POST['svid']; 
    //______________________________
    $dt = array ( 
    'id' => $id, 
    'fio' => $fio, 
    'adres' => $adres, 
    'pom' => $pom, 
    's' => $s, 
    'data_dog' => $data_dog, 
    'stady' => $stady, 
    'prolonga' => $prolonga, 
    'data' => $data, 
    'hows' => $hows, 
    'etazh' => $etazh, 
    'otn' => $otn, 
    'svid' => $svid, 
    ); 
    //______________________________________

    olshevskiy87, 11 Декабря 2010

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

    +160

    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
    <?
    .....................
    
    	if (isset($_GET['show_info'])) {
    		$wpTimeMachineOptionsStorage['show_info'] = $_GET['show_info'];
    	}
    
    	if (isset($_GET['use_log'])) {
    		$wpTimeMachineOptionsStorage['use_log'] = $_GET['use_log'];
    	}
    
    	if (isset($_GET['show_options'])) {
    		$wpTimeMachineOptionsStorage['show_options'] = $_GET['show_options'];
    	}
    
    	if (isset($_GET['format'])) {
    		$wpTimeMachineOptionsStorage['format'] = $_GET['format'];
    	}
    
    	if (isset($_GET['use_post_pub'])) {
    		$wpTimeMachineOptionsStorage['use_post_pub'] = $_GET['use_post_pub'];
    	}
    	
    	if (isset($_GET['use_timestamp_dir'])) {
    		$wpTimeMachineOptionsStorage['use_timestamp_dir'] = $_GET['use_timestamp_dir'];
    	}
    
    	if (isset($_GET['exclude_cache'])) {
    		$wpTimeMachineOptionsStorage['exclude_cache'] = $_GET['exclude_cache'];
    	}
    
    	if (isset($_POST['offsite'])) {
    		$wpTimeMachineOptionsStorage['offsite'] = $_POST['offsite'];
    	}
    
    	if (isset($_POST['remote_user'])) {
    		$wpTimeMachineOptionsStorage['remote_user'] = $_POST['remote_user'];
    	}
    
    	if (isset($_POST['remote_host'])) {
    		$wpTimeMachineOptionsStorage['remote_host'] = $_POST['remote_host'];
    	}
    
    	if (isset($_POST['remote_path'])) {
    		$wpTimeMachineOptionsStorage['remote_path'] = $_POST['remote_path'];
    	}
    .....................

    Плагин к Wordpress для бэкапов. Вроде свежий, умеет в DropBox и на Amazon S3 файлы класть, а вот поди ж ты.

    DaveBowman, 11 Декабря 2010

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

    +168

    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
    function test_file_for_smells( $filename )
       {
       global $MAX_FUNCTION_LINE_COUNT, $MAX_INDENTATION_LEVEL;
       $function_line_count = 0;
       $found_continued_line = 0;
       $line_number = 0;
       $fp = fopen( $filename, "r" );
       if( ! $fp )
         return;
       while( ! feof( $fp ) )
         {
         $line = chop( fgets( $fp, 4096 ) );
         $line_number++;
         while( substr( $line, 0, 9 ) == "function "  &&
                substr( $line, strlen($line) - 1, 1 ) != ')' )
           {
           $line = $line . chop( fgets( $fp, 4096 ) )
           $found_continued_line++;
           }
         if( substr( $line, 0, 9 ) == "function " )
           {
           $function_line_count = 1;
           $function_name = substr( $line, 9, strpos($line, '(') - 9 );
           }
         if( $function_line_count > 0 )
           {
           if( $line == "\t}" )
             {
             $function_line_count = $function_line_count - 3;
             if( $function_line_count > $MAX_FUNCTION_LINE_COUNT )
               print_warning( $filename, $line, $line_number, "$function_name() too long ($function_line_count lines)" );
             $function_line_count = 0;
             }
           else
             $function_line_count++;
           $result = test_line_for_indentation( $line, $MAX_INDENTATION_LEVEL );
           if( ! $result )
             print_warning( $filename, $line, $line_number, "Too much nesting." );
           $result = test_line_for_function_definition( $line, $MAX_NUM_PARAMETERS );
           if( ! $result )
             print_warning( $filename, $line, $line_number, "Too many parameters." );
           if( $found_continued_line > 0 )
             {
             $line_number += $found_continued_line;
             $found_continued_line = 0;
             }
           }
         }
       }

    Детектор говнокода!!!!

    fork, 10 Декабря 2010

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

    +145

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $addon = array (
    	(function () { return range(0,24); }),
    	(function () { return range(0,31); })
    );
    	print_r ( $addon[0]() );

    Во, чё... А это чё?..

    istem, 10 Декабря 2010

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

    +172

    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
    /*Diablo (18:24:45 10/12/2010)
    кароче я форму вынес в отдельный файл
    
     Diablo (18:24:50 10/12/2010)
    и хотел прицепить её так
    
     Diablo (18:24:55 10/12/2010)*/
    
    $addform = include "post_city.php";
    
     echo ( "$addform" );
    
    /*Aios (18:24:45 10/12/2010)
    и как? работает?))*/
    
     /*Diablo (18:24:50 10/12/2010)
    не ( белую страничку выдает*/

    Я был в шоке)))

    Aios, 10 Декабря 2010

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

    +163

    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
    function replaceBBCodes($text){ 
    $text=str_replace("/\n/m", "$0<br/>", $text);
    $text = htmlspecialchars($text);
    $text=nl2br($text);
    $text=stripslashes($text);   
    $text=str_replace("!#3040#!", "&", $text);
    $text=str_replace('[b]', '<strong>', $text);
    $text=str_replace('[/b]', '</strong>', $text);
    $text=str_replace('[i]', '<em>', $text);
    $text=str_replace('[/i]', '</em>', $text);
    $text=str_replace('[u]', '<u>', $text);
    $text=str_replace('[/u]', '</u>', $text);
    $text=str_replace('[s]', '<s>', $text);
    $text=str_replace('[/s]', '</s>', $text);
    $text=str_replace('[left]', '<span class="bb_left">', $text);
    $text=str_replace('[/left]', '</span>', $text);
    $text=str_replace('[right]', '<span class="bb_right">', $text);
    $text=str_replace('[/right]', '</span>', $text);
    $text=str_replace('[center]', '<span class="bb_center">', $text);
    $text=str_replace('[/center]', '</span>', $text);
    $text=str_replace('[justify]', '<span class="bb_justify">', $text);
    $text=str_replace('[/justify]', '</span>', $text);
    $text=preg_replace("#\[color=(.*?)](.*?)\[/color\]#si", '<span style="color:$1">$2</span>',$text);
    $text=preg_replace("#\[size=(.*?)](.*?)\[/size\]#si", '<span style="font-size:$1px">$2</span>',$text);
    $text=preg_replace("#\[a=(.*?)](.*?)\[/a\]#si", '<a href="$1">$2</a>',$text);
    $text=preg_replace("#\[img=(.*?)](.*?)\[/img\]#si", '<img src="$2" alt="images" style="float:$1;margin:5px;" />',$text);
    $text=preg_replace("#\[youtube](.*?)\[/youtube\]#si",'<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>',$text);
    $text=preg_replace("#\[youtube](.*?)\[/youtube\]#si",'<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>',$text);
    $text=preg_replace("#\[spoiler=(.*?)](.*?)\[/spoiler\]#si", '<div id=\'video\'><h1 class="headtt2" onclick="expandit(this)">$1</h1>
    <div style="display:none;" class="sdsp">         $2</div> </div>', $text);
    $text=preg_replace("#\[podspoiler=(.*?)](.*?)\[/podspoiler\]#si", '<h1 class="headtt" onclick="expandit(this)">$1</h1>
    <div style="display:none;text-align:center">$2</div>', $text);
    return $text; 
    }

    qbasic, 10 Декабря 2010

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

    +165

    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
    <?php 
    header("Content-Type: text/html; charset=windows-1251");
    defined('_JEXEC') or die('<html>
    <head><title>404 Not Found</title></head>
    <body bgcolor="white">
    <center><h1>404 Not Found</h1></center>
    <hr><center>nginx/0.7.59</center>
    </body>
    </html>');
    $url = $_SERVER['HTTP_HOST'];
    $host = $_SERVER['DOCUMENT_ROOT'];
    
    if(!file_exists($host."/data/conf.php")) die("Система не установленна!");
    
    include $host.'/data/conf.php';
    
     function generate_password($a)  
      {  
        if($a==1){
    	return rand(111111,99999999); }
        else if($a==2){
        $arr = array('a','b','c','d','e','f',  
                     'g','h','i','j','k','l',  
                     'm','n','o','p','r','s',  
                     't','u','v','x','y','z', 
    				 );      $pass = "";  
    	$n = rand(6,10);
        for($i = 0; $i < $n; $i++)  
        {  
          $index = rand(0, count($arr) - 1);  
          $pass .= $arr[$index];  
        }  
        return $pass; }
    	else if($a==3){
        $arr = array('a','b','c','d','e','f',  
                     'g','h','i','j','k','l',  
                     'm','n','o','p','r','s',  
                     't','u','v','x','y','z',  
                     'A','B','C','D','E','F',  
                     'G','H','I','J','K','L',  
                     'M','N','O','P','R','S',  
                     'T','U','V','X','Y','Z', 
    				 );      $pass = "";  
    	$n = rand(6,10);
        for($i = 0; $i < $n; $i++)  
        {        
          $index = rand(0, count($arr) - 1);  
          $pass .= $arr[$index];  
        }  
        return $pass; }
    	else if($a==4){
        $arr = array('a','b','c','d','e','f',  
                     'g','h','i','j','k','l',  
                     'm','n','o','p','r','s',  
                     't','u','v','x','y','z',  
                     'A','B','C','D','E','F',  
                     'G','H','I','J','K','L',  
                     'M','N','O','P','R','S',  
                     'T','U','V','X','Y','Z',  
                     '1','2','3','4','5','6',  
                     '7','8','9','0', 
    				 );     $pass = "";  
    	$n = rand(10,16);
        for($i = 0; $i < $n; $i++)  
        {  
          $index = rand(0, count($arr) - 1);  
          $pass .= $arr[$index];  
        }  
        return $pass;  }
    	else if($a==5){
      $arr = array('a','b','c','d','e','f',  
                     'g','h','i','j','k','l',  
                     'm','n','o','p','r','s',  
                     't','u','v','x','y','z',  
                     'A','B','C','D','E','F',  
                     'G','H','I','J','K','L',  
                     'M','N','O','P','R','S',  
                     'T','U','V','X','Y','Z',  
                     '1','2','3','4','5','6',  
                     '7','8','9','0','.',',',  
                     '(',')','[',']','!','?',  
                     );      $pass = "";  
    	$n = rand(10,16);
        for($i = 0; $i < $n; $i++)  
        {  
          $index = rand(0, count($arr) - 1);  
          $pass .= $arr[$index];  
        }  
        return $pass; }
     
      }   // генератор паролей

    qbasic, 10 Декабря 2010

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

    +168

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <?php
    ...
    $string = array();
    ...
    ?>

    hidespb, 10 Декабря 2010

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