1. Список говнокодов пользователя d3n4

    Всего: 4

  2. C# / Говнокод #12313

    +115

    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
    public bool checkUser(UserModel model = null)
    {
    	check:
    	if(model != null)
    		if(model.authenticated != false)
    			if(model._id > 0)
    				return true;
    			else
    				goto check;
    		else
    			goto check;
    	else
    		goto check;
    	return false;
    }

    а вдруг?!

    d3n4, 19 Декабря 2012

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

    +47

    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
    # GET /dialog([0-9]+)
    Public Static Function Dialog($senderId){
        $user = Session::Restore();
        IF($user){
            $users = Collection::Get('users', 'UserModel');
            $sender = $users->Find( Query::Equal('id', $senderId) );
            IF(sizeof($sender) > 0){
                $sender = $sender[0];
                $profile_view = self::Profile($sender->id);
                $mails = Collection::Get('mail', 'MailModel');
                $in = $mails->Find( Query::All( Query::Equal( 'tid', $user->id ), Query::Equal('fid', $sender->id) ) );
                $out = $mails->Find( Query::All( Query::Equal( 'fid', $user->id ), Query::Equal('tid', $sender->id) ) );
                $dialog = array();
    
                ForEach($in as $inMsg){
                    IF(!$inMsg->read)
                    {
                        $inMsg->read = 1;
                        $inMsg->save();
                    }
                }
    
                ForEach( $in as $message ){
                    IF(!isset($dialog[$message->time]))
                        $dialog[$message->time] = array();
                    $dialog[$message->time][] = array('type'=>'in', 'message'=>$message);
                }
    
                ForEach( $out as $message ){
                    IF(!isset($dialog[$message->time]))
                        $dialog[$message->time] = array();
                    $dialog[$message->time][] = array('type'=>'out', 'message'=>$message);
                }
    
                ksort($dialog);
    
                $profile_view->Set('ProfileContent', 'dialog.php')->Set('dialog', $dialog);
                return $profile_view;
            }
            throw new ForbiddenException( l('Sender is not found') );
        }
        throw new ForbiddenException( l('User is not authenticated') );
    }

    d3n4, 18 Декабря 2012

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

    +41

    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
    # POST /register
    Public Function Register(){
        foreach((array)$_POST as $k=>$v)
            $_POST[$k] = addslashes(strip_tags($v));
        $login = $_POST['Login'];
        $password = $_POST['Password'];
        $email = $_POST['Email'];
        $firstname = $_POST['FirstName'];
        $lastname = $_POST['LastName'];
        $errors = array();
    
        IF(!Session::Restore()){
            Driver::Init();
            IF(String::is_valid_email_address($email)){
                IF(strlen($login) > 3 && strlen($login) <= 12 && String::Check('([a-zA-Z0-9_]+)', $login) ){
                    IF(strlen($password) > 5 && $password == $_POST['RePassword']){
                        $users = Collection::Get('users')->Select(Query::Equal('login', $login));
                        IF(!sizeof($users)){
                            $user = new User;
                            $user->login = strtolower($login);
                            $user->password = md5($password);
                            $user->regtime = time();
                            $photo = UploadedFiles::Get('Photo');
                            IF($photo)
                                IF($photo->exists){
                                    $photoHash = md5('photo_'.$user->login);
                                    $photosPath = APPLICATION_DIR.'/assets/uploads/photos';
                                    $photo->Path = $photosPath.'/tmp/'.$photoHash;
                                    ImageProcessing::MakeThumb($photo->Path, $photosPath.'/300/'.$photoHash.'.jpg', 100, 300, 500);
                                    ImageProcessing::MakeThumb($photo->Path, $photosPath.'/100/'.$photoHash.'.jpg', 100, 100);
                                    ImageProcessing::MakeThumb($photo->Path, $photosPath.'/50/'.$photoHash.'.jpg', 100, 50);
                                    @unlink($photo->Path);
                                    $user->photo = $photoHash;
                                }
                            $user->save();
                            Session::Link($login, $password);
                            return Router::Redirect('/profile');
                        }
                        else $errors[] = l('This username is already taken');
                    }
                    else $errors[] = l('Password length must be more than 3');
                }
                else $errors[] = l('Login length must be more than 3, and less than 13 characters and contain only Latin characters');
            }
            else $errors[] = l('Your email address must be in the format of [email protected]');
        }
        else $errors[] = l("You are already registered");
        $view = new View('main.php');
        return $view->Set('Content', 'registration.php')->Set('login', $login)->Set('email', $email)->Set('firstname', $firstname)->Set('lastname', $lastname)->Set('errors', $errors);
    }

    Ну так.

    d3n4, 14 Декабря 2012

    Комментарии (8)
  5. C++ / Говнокод #12259

    +25

    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
    public OnPlayerSpawn(playerid) {
        IsSpawned[playerid]=1;
        if(Team[playerid]==ZOMBIE) { TextDrawSetString(Textdraw9[playerid],"You are a ~r~Zombie~w~. Kill & Infect every Human to complete your mission.");
    	} else if(Team[playerid]==HUMAN) { TextDrawSetString(Textdraw9[playerid],"You are a ~r~Human~w~. Prevent Zombie attacks and survive till the end."); }
        TextDrawHideForAll(Box); TextDrawHideForAll(text_Top5[0]); TextDrawHideForAll(text_Top5[1]);
    	TextDrawShowForPlayer(playerid, Textdraw0);	 TextDrawShowForPlayer(playerid, Textdraw1);
    	TextDrawShowForPlayer(playerid, Textdraw2);	 TextDrawShowForPlayer(playerid, Textdraw3);
    	TextDrawShowForPlayer(playerid, Textdraw4);	 TextDrawShowForPlayer(playerid, Textdraw5);
    	TextDrawShowForPlayer(playerid, Textdraw6);	 TextDrawShowForPlayer(playerid, Textdraw7);
    	TextDrawShowForPlayer(playerid, Textdraw9[playerid]);
    	TextDrawShowForPlayer(playerid, Textdraw15); TextDrawShowForPlayer(playerid, Textdraw16[playerid]);
    	SetTeam(playerid); SetClass(playerid); 
    	if(Infection==1) {
            Infection=0;
            if(Totalplayers>=2) {
    			SetTimer("InfectionLoad",0,0);
    		} else if(Totalplayers>=10) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=10) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=20) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=30) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=45) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=60) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers<=75) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}
    	} return 1; }

    Серьезно?

    d3n4, 08 Декабря 2012

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