<?php
if (!defined('SECURED'))
{
die("Unknown Error!");
}
include'includes/func_conv_chars.php';
include'includes/func_check.php';
include'includes/func_gensid.php';
title(' Register');
div('Register','b');
if(!empty($_POST['login']) && !empty($_POST['pass']))
{
$login=val($_POST['login']);
$pass=val($_POST['pass']);
$pass2=val($_POST['pass2']);
$win = array("?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?");
$checklogin=str_replace($win,'<!>',$login);
if($_SESSION['ref']!=$_POST['kod']) $error='Wrong Enter code!<br/>';
if(!check($pass, '') || strlen($pass)>20) $error.='Password should not contain more than 20 characters <b>A-Z, 0-9</b><br/>';
if($pass!=$pass2) $error.='Passwords do not match!<br/>';
if(strlen(utfwin($login))>20 || (ereg("<!>",$checklogin) && ereg("[a-zA-Z]",$login)) || !check($login, 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789-.=@!()')) $error.='Username must not contain more than 20 characters <b>A-Z, ?-?, 0-9,-.=()@!</b><br/>';
list($check_if_exists)=mysql_fetch_array(mysql_query("select id from users where login='".$login."';"));
if(mysql_affected_rows()!=0) $error.='A user with this login already registered!<br/>';
if(!empty($error))
{
echo div($error,'c');
} else
{
$session=generate_sid();
mysql_query("INSERT INTO `users` ( `id` , `login` , `pass` , `reg_date`, `level` , `last`, `session` , `ver`, `ip`, `soft`)
VALUES (0, '$login', '$pass', '".time()."', '0', '".time()."', '$session', '$ver', '$ip', '$soft');");
echo'Registration is successful!<br/>Your login - <b>'.$login.'</b>, Password - <b>'.$pass.'</b><br/>
<a href="'.$_SERVER['PHP_SELF'].'?sid='.$session.'&'.SID.'">Continue</a><br/>';
footer();
exit;
}
}
echo'Registration will allow you to:<br/>
1. To place in your profile information about yourself. <br/>
2. To count placed your files. And also be able to remove them (if necessary). <br/>
3. Left to count your comments. <br/>
4. To count your files. <br/>
5. Borrow your personal username / nickname / name (no one will be able to post and on your behalf). <br/>
6. Leaving complaint files that violate the rules of the file share.<br/>';
echo $separator;
if($ver=='wml')
{
echo 'Login:<br/>';
echo '</small><input name="login'.$rand.'" type="text" value="" maxlength="20"/><br/><small>';
echo 'Password:<br/>';
echo '</small><input name="pass'.$rand.'" type="password" value="" maxlength="20"/><br/><small>';
echo 'Repeat password:<br/>';
echo '</small><input name="pass2'.$rand.'" type="password" value="" maxlength="20"/><br/><small>';
echo'<img src="pic.php?'.session_id().'" alt="kod"/><br/>
Code:<br/>
</small><input name="kod'.$rand.'" type="text" size="5"/><br/><small>';
echo'<anchor>OK<go href="'.$_SERVER['PHP_SELF'].'?mode=reg&'.SID.'" method="post">';
echo'<postfield name="login" value="$(login'.$rand.')"/>';
echo'<postfield name="pass" value="$(pass'.$rand.')"/>';
echo'<postfield name="pass" value="$(pass2'.$rand.')"/>';
echo'<postfield name="kod" value="$(kod'.$rand.')"/>';
echo'</go></anchor><br/>';
} else
{
echo '<form action="'.$_SERVER['PHP_SELF'].'?mode=reg&'.SID.'" method="post">';
echo 'Login:<br/>';
echo '<input name="login" type="text" value="" maxlength="40"/><br/>';
echo 'Password:<br/>';
echo '<input name="pass" type="password" value="" maxlength="40"/><br/>';
echo 'Repeat password:<br/>';
echo '<input name="pass2" type="password" value="" maxlength="40"/><br/>';
echo'<img src="pic.php?'.session_id().'" alt="kod"/><br/>
Code:<br/>
<input name="kod" type="text" size="5"/><br/>';
echo '<input type="submit" value="OK"/></form>';
}
echo $separator;
echo $goback;
?>