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

    Всего: 1

  2. PHP / Говнокод #8864

    +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
    <?php
    	if(!isset($legal_include)) { header("HTTP/1.0 404 Not Found"); die(); }
    	
    	if(!isset($_POST['login']) OR !isset($_POST['password']) OR !isset($_POST['password_retype'])) {
    		text(gic('tpl/register_form.html'));
    	} else {
    		$_POST = postget();
    		$error = array();
    		if(strlen($_POST['login']) < 4 OR empty($_POST['login'])) {
    			array_push($error, 'len_login');
    		} else {
    			if(preg_match('/^[a-z0-9]+$/', $_POST['login'])) {
    				if(check_avalaibility($_POST['login']) != true) {
    					array_push($error, 'login_used');
    				}
    			} else {
    				array_push($error, 'inc_login');
    			}
    		}
    			
    		if(strlen($_POST['password']) < 4 OR empty($_POST['password'])) {
    			array_push($error, 'len_passwd');
    		} else {
    			if($_POST['password'] != $_POST['password_retype']) {
    				array_push($error, 'inc_passwds');
    			}
    		}
    		
    		if(count($error) > 0) {
    			$fields = array('inc_login' => language($_SESSION['lang'], 'inc_login'), 
    			'len_login' => language($_SESSION['lang'], 'len_login'),
    			'len_passwd' => language($_SESSION['lang'], 'len_passwd'),
    			'login_used' => language($_SESSION['lang'], 'login_used'),
    			'inc_passwds' => language($_SESSION['lang'], 'inc_passwds'));
    			$text = language($_SESSION['lang'], 'have_errs').'<ul>';
    			foreach($error as $value) {
    				$text .= '<li>'.$fields[$value].'</li>';
    			}
    			$text .= '</ul>';
    			error($text, 'text');
    			sendback('?register');
    		} else {
    			$SQL = 'INSERT INTO `'.pr.'users` (`login`, `password`, `levels`) VALUES (\''.$_POST['login'].'\', \''.md5($_POST['password']).'\', 1)';
    			mysql_query($SQL);
    			$_SESSION['logined'] = true;
    			$_SESSION['levels'] = 1;
    			$_SESSION['name'] = $_POST['login'];
    		}
    	}
    	
    	function check_avalaibility($username) {
    		$SQL = 'SELECT `login` FROM `'.pr.'users` WHERE `login` = \''.$username.'\'';
    		$result = mysql_query($SQL);
    		if(mysql_num_rows($result) > 0) {
    			return false;
    		} else {
    			return true;
    		}
    	}
    ?>

    why so serious?

    afr0xED, 18 Декабря 2011

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