2 if (@$config == NULL) die ("");
4 function checkAddress($ip)
7 // Не проверяем IP если не требуется
8 if ($config['limit_account_from_one_ip'] == 0)
10 $list = $rDB->selectCell("SELECT `last_ip` FROM `account` WHERE `last_ip` = ?", $ip);
16 function checkName($username)
19 $list = $rDB->selectCell("SELECT `username` FROM `account` WHERE `username` = ?", $username);
24 //==============================================================
26 //==============================================================
29 $ip = @$_SERVER['REMOTE_ADDR'];
33 echo $lang['reg_err_db'];
36 else if (checkAddress($ip))
38 echo $lang['reg_err_one_ip'];
41 else if(@$_POST['script'] == 'reg')
43 $name = @$_POST['account_name'];
44 $username = strtoupper(@$_POST['account_name']);
45 $password = strtoupper(@$_POST['account_pass']);
46 $email = @$_POST['account_email'];
47 $nameLen = strlen($name);
48 $passLen = strlen($password);
50 if (empty($username) OR empty($password))
51 echo $lang['reg_err_name_pass'];
52 else if ($nameLen < 3 OR $nameLen > 16)
53 echo $lang['reg_err_name_size'];
54 else if ($passLen < 3 OR $passLen > 16)
55 echo $lang['reg_err_pass_size'];
56 else if (!preg_match("/^\w*$/","$username$password"))
57 echo $lang['reg_err_charset'];
58 else if (preg_match("/[(а-я)|(А-Я)]/","$username$password"))
59 echo $lang['reg_err_charset'];
60 else if ($username == $password)
61 echo $lang['reg_err_name_is_pass'];
62 else if (!eregi("^[a-z0-9\._-]+@[a-z0-9\._-]+\.[a-z]{2,4}$", $email))
63 echo $lang['reg_err_mail'];
64 else if (checkName($username))
65 echo $lang['reg_err_name_in_use'];
68 $res = $rDB->query("INSERT INTO `account` (`username`, `sha_pass_hash`, `email`, `last_ip`, `expansion`) VALUES (?, SHA1(?), ?, ?, '2')", $username, $username.":".$password, $email, $ip);
71 echo $lang['reg_success'];
75 echo $lang['reg_err_query'];
81 echo '<form method="post" action="?register" name="acc">';
82 echo '<input type="hidden" name="script" value="reg">';
83 echo '<table class=find>';
84 echo '<tr><td class=top colspan=2>';
85 echo '<table class=findtop><tr><td class=topleft> </td><td class=top>'.$lang['reg_register'].'</td><td class=topright> </td></tr></table>';
87 echo '<tr><td>'.$lang['reg_name'].'</td><td><input type="text" name="account_name" maxlength="16" size="30" value="'.@$name.'"></td></tr>';
88 echo '<tr><td>'.$lang['reg_password'].'</td><td><input type="password" name="account_pass" maxlength="16" size="30"></td></tr>';
89 echo '<tr><td>E-Mail</td><td><input type="text" name="account_email" size="30" maxlength="32" value="'.@$email.'"></td></tr>';
90 echo '<tr><td class=bottom colspan=2><input type=submit value="'.$lang['reg_ok_register'].'"></td></tr>';