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

    +183

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    private static function IIf($itr, $truu, $falss) {
      if($itr)
          return $truu;
      else
         return $falss;
    }

    Думаю, такое надо вносить в coding conventions...

    maxikar, 05 Мая 2010

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

    +167

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    $fileContent=file_get_contents($this->rootPath.'app/'.$this->interface.$this->handler.$this->p_h.'.php');
                	if (preg_match('/class\s{1,}\b'.$this->handler.$this->p_h.'\b/i', $fileContent,$matches)) {
                        .............
                        if (preg_match('/function\s{1,}\b'.$this->action.$this->p_a.'\b/i', $fileContent,$matches)) {
                			$class=$this->handler.$this->p_h;
    				$action=$this->action.$this->p_a;
                			$this->includeClass($class,$action);
                            return;
    
                         .............

    Так мы проверяем наличие медота в классе ((

    minisot, 05 Мая 2010

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

    +163

    1. 1
    2. 2
    3. 3
    if(preg_match("#puid=(\d+)#si",$_SERVER['REQUEST_URI'],$m)) {
                     $parent_user_id = $m[1]; 
                     ................

    Получаем $_GET

    minisot, 05 Мая 2010

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    function summArray($arr) 
    {
        $summ = 0;
        foreach($arr as $a) {
            $summ += intval($a);
        }
        
        return $summ;
    }

    minisot, 05 Мая 2010

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

    +166

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function trimzero($i){
    	$i=trim($i);
    	if(is_string($i) && strlen($i)>1){
    		while(ereg("^0",$i))
    			$i=ereg_replace("^0",'',$i);
    	}
    	return $i;
    }

    minisot, 05 Мая 2010

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

    +164

    1. 1
    2. 2
    3. 3
    <?php
    $count =300;
    define('MAXPROCESS',$count);

    $count дальше естественно нигде не используется..

    null, 05 Мая 2010

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

    +168

    1. 1
    2. 2
    $date=date("d.m.y");
    $data=date("d.m.y");

    В header.php, который инклюдитя в каждом файле. И, что самое главное, в коде используются обе переменных!

    azzz, 04 Мая 2010

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

    +167

    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
    function my_isinteger($int)
    {
       $new_int = '';
       for($i=0;$i<strlen($int);$i++)
       {
          if( $int[$i] == "0" )
          {
             $new_int .= "0";
          }
          if( $int[$i] == "1" )
          {
             $new_int .= "1";
          }
          if( $int[$i] == "2" )
          {
             $new_int .= "2";
          }
          if( $int[$i] == "3" )
          {
             $new_int .= "3";
          }
          if( $int[$i] == "4" )
          {
             $new_int .= "4";
          }
          if( $int[$i] == "5" )
          {
             $new_int .= "5";
          }
          if( $int[$i] == "6" )
          {
             $new_int .= "6";
          }
          if( $int[$i] == "7" )
          {
             $new_int .= "7";
          }
          if( $int[$i] == "8" )
          {
             $new_int .= "8";
          }
          if( $int[$i] == "9" )
          {
             $new_int .= "9";
          }
       }
       if ( $int == $new_int )
       {
          return(True);
       }
       else
       {
          return(False);
       }
    }

    Набрел в исходниках старого проекта который до сих пор работает) но начинал я его писал лет 5 назад), знаний тогда было маловато

    W1R0X, 02 Мая 2010

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

    +171

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if (isset($_POST['nick']))       {$nick = $_POST['nick'];}
    if (isset($_POST['pass']))       {$pass = $_POST['pass'];}
    
    
    if (isset($_GET['nick'])) {$nick = $_GET['nick'];}
    if (isset($_GET['pass'])) {$pass = $_GET['pass'];}

    один из видеоуроков Е.Попова=)

    Ice, 02 Мая 2010

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <?php
    
    function hashPW($value,$type = "sha1"){
    		return $type($value);
    }
    
    ?>

    Решил что удобнее в проекте будет использовать хэш настраиваемый в админке

    DanxilLs, 02 Мая 2010

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