1. Лучший говнокод

    В номинации:
    За время:
  2. PHP / Говнокод #7585

    +152

    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
    public function getObject()
    	{
    		$args = func_get_args();
    		if (empty($args)) {
    			$this->_throwException('wrong call of method - interface should be as 1st parameter');
    		}
    
    		$interface = array_shift($args);
    		
    		$class = $this->getInjection($interface);
    
            $argsCnt = count($args);
            if ($argsCnt == 0) {
                $object = new $class;
            }
            else if ($argsCnt == 1) {
                $object = new $class($args[0]);
            }
            else if ($argsCnt == 2) {
                $object = new $class($args[0], $args[1]);
            }
            else if ($argsCnt == 3) {
                $object = new $class($args[0], $args[1], $args[2]);
            }
            else if ($argsCnt == 4) {
                $object = new $class($args[0], $args[1], $args[2], $args[3]);
            }
            else if ($argsCnt == 5) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4]);
            }
            else if ($argsCnt == 6) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]);
            }
            else if ($argsCnt == 7) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6]);
            }
            else if ($argsCnt == 8) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7]);
            }
            else if ($argsCnt == 9) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8]);
            }
            else if ($argsCnt == 10) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9]);
            }
            else if ($argsCnt == 11) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10]);
            }
            else if ($argsCnt == 12) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10], $args[11]);
            }
            else if ($argsCnt == 13) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10], $args[11], $args[12]);
            }
            else if ($argsCnt == 14) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10], $args[11], $args[12], $args[13]);
            }
            else if ($argsCnt == 15) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10], $args[11], $args[12], $args[13], $args[14]);
            }
            else {
        	   $this->_throwException('it looks like you use more than 15 arguments when trying to instantiate an object of class '.$class.' - that\'s ugly');
            }
    
            return $object;
    	}

    webeith, 18 Августа 2011

    Комментарии (25)
  3. Java / Говнокод #7523

    +80

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    try {
    ...
    } catch (Exception ex) {
    	wdComponentAPI.getMessageManager().reportException("ERROR", true);
    }

    Информативно так

    foGa, 12 Августа 2011

    Комментарии (25)
  4. Куча / Говнокод #7397

    +144

    1. 1
    <span onmouseover="this.style.color='green'" onmouseout="this.style.color='black'">текст</span>

    :hover для лохов

    jQuery, 30 Июля 2011

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

    +160

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <?php 
    function antihack(&$var){   
    if(is_array($var)) array_walk($var, 'antihack');  
    else $var = htmlspecialchars(stripslashes(mysql_real_escape_string($var)), ENT_QUOTES, 'UTF-8');   
    }   
    
    foreach(array('_SERVER', '_GET', '_POST', '_COOKIE', '_REQUEST') as $v){   
    if(!empty(${$v})) array_walk(${$v}, 'antihack');  
    }  
    ?>

    http://homephp.ru/phpcode/index.php?system=bild&stat=173445591-534250613&

    jQuery, 21 Июня 2011

    Комментарии (25)
  6. JavaScript / Говнокод #7015

    +171

    1. 1
    var e=("article,aside,footer,header,nav,section").split(',');

    Найдено в дебрях одного сайта.

    lucidfox, 21 Июня 2011

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

    +156

    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
    <?php 
    	if(isset($_GET["status"])) {
    		//Определяем переменные
    		$user_id = $_GET['user_id'];
    		$operator_id = $_GET['operator_id'];
    		$smsid = $_GET['smsid'];
    		$operator_id_str = $_GET['operator_id_str'];
    		$num = $_GET['num'];
    		$msg_trans = $_GET['msg_trans'];
    		$msg = $_GET['msg'];
    		$cost_rur = $_GET['cost_rur'];
    		$ratepoints = $cost_rur; //Рейтинг = стоимость смс
    		
    		//Подключаемся к бд
    		$dblocation = "localhost";	 // Имя сервера
    		$dbuser = "****";          // Имя пользователя
    		$dbpasswd = "******";            // Пароль
    		$dbname = "******"; //Имя бд
    		$dbcnx = @mysql_connect($dblocation,$dbuser,$dbpasswd);
    		if (!$dbcnx) {
    			  echo("Не удалось установить соеденение");
    			  exit();
    		} else  {
    						if (!@mysql_select_db($dbname, $dbcnx)) {
    							  echo  "База данных недоступна <br />" ;
    							  exit();
    						} else {
    							//Проверяем зарегестрирован ли пользователь
    							$changeuser = @mysql_query("SELECT * FROM jos_users WHERE  username='$user_id'");
    							if(@mysql_num_rows($changeuser) > 0) {
    							//Пользователь зарегестрирован
    								@mysql_query("INSERT INTO sms (operator_id, operator_id_str, user_id, smsid, num, msg_trans, msg, cost_rur) VALUES ('$operator_id','$operator_id_str','$user_id','$smsid','$num','$msg_trans','$msg','$cost_rur')"); //Добавляем смс
    								@mysql_query("UPDATE jos_users SET rate = rate +1 WHERE username='$user_id'"); //Увеличиваем рейтинг
    								@mysql_query("UPDATE jos_users SET sms = sms +1 WHERE username='$user_id'"); //Увеличиваем кол-во смс
    								$rate = @mysql_fetch_array(@mysql_query("SELECT rate FROM jos_users WHERE username='$user_id'"));
    								echo "SMS Send OK rate +1 your rate: ".$rate['rate']."";
    							} else {
    							/*Пользователь не зарегестрирован,
    							Регестрируем пользователя*/
    							$regdate = date("Y-m-d  H:i:s");
    							
    							//Генерируем пароль
    							$pass = rand(10000, 99999);
    							$sqlpass = md5($pass);
    							
    							//Добавляем пользователя
    								@mysql_query("INSERT INTO jos_users (name, username, password, usertype, gid, registerDate, lastvisitDate) VALUES ('$user_id', '$user_id', '$sqlpass', 'Registered', '18', '$regdate', '$regdate')");
    								$getnewuserid = @mysql_fetch_array(@mysql_query("SELECT id FROM jos_users WHERE username='$user_id'"));
    								@mysql_query("INSERT INTO jos_core_acl_aro (section_value, value, order_value, name, hidden) VALUES ('users', '{$getnewuserid['id']}', '0', '$user_id', '0')");
    								$getaro_id = @mysql_fetch_array(@mysql_query("SELECT id FROM jos_core_acl_aro WHERE name='$user_id'"));
    								@mysql_query("INSERT INTO jos_core_acl_groups_aro_map (group_id, aro_id) VALUES ('18', '{$getaro_id['id']}')");
    								
    								@mysql_query("INSERT INTO sms (operator_id, operator_id_str, user_id, smsid, num, msg_trans, msg, cost_rur) VALUES ('$operator_id','$operator_id_str','$user_id','$smsid','$num','$msg_trans','$msg','$cost_rur')"); 
    								@mysql_query("UPDATE jos_users SET rate = rate +1 WHERE username='$user_id'");
    								@mysql_query("UPDATE jos_users SET sms = sms +1 WHERE username='$user_id'");
    								$rate = @mysql_fetch_array(@mysql_query("SELECT rate FROM jos_users WHERE username='$user_id'"));
    								echo "SMS Register complete. Login: ".$user_id." Pass: ".$pass." Your rate: ".$rate['rate']."";
    							}
    									}
    			}
    	}
    ?>

    phplamer, 20 Июня 2011

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

    +154

    1. 1
    2. 2
    3. 3
    public function assign($a, $b) {
        parent::assign($a, $b);
    }

    Из того же проекта.
    И все-таки хорошо, что программеры понимают ООП :-)

    max_wp, 03 Июня 2011

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

    +187

    1. 1
    2. 2
    3. 3
    if($query && !$query) {
        $query = null;
    }

    Оо

    jQuery, 02 Июня 2011

    Комментарии (25)
  10. 1C / Говнокод #6808

    −136

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Если СтрФайлЗагрузки = Ложь Тогда
    		СтрФайлЗагрузки = ФайлЗагрузки;
    	Иначе
    		ФайлЗагрузки = СтрФайлЗагрузки;
    КонецЕсли;

    1vasia1, 01 Июня 2011

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

    +147

    1. 1
    else echo "Some error occurred.";

    Дзен говнокода

    shinisaru, 24 Мая 2011

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