Файл: register.php
Строк: 86
<?php
include('common.php');
if(islogged()){
header('Location: /index.php');
echo '<div class="list2">'.$lang['error'].'</div>';
}else{
echo theader();
if($devel)
echo '<div class="list2">' . $lang['develnote'] . ' <b>' . $s_megacode . '</b></div>';
$code = getarg('code');
if($code == $s_megacode){
$newcode = clean(getcode());
mysql_query("insert into `invites` set `user`='".getid()."', `code`='$newcode'");
echo '<div class="link2">' . $lang['uberaccepted'] . '</div>
<form method="get" action="/register.php">
<div class="link2">
<input type="hidden" name="code" value="' . $newcode . '" />
<input type="submit" value="' . $lang['continue'] . '" />
</form></div>';
}
elseif($code == NULL){
echo '<div class="list2">' . $lang['inviteonly'] . '</div>';
echo tcodebox();
echo '<div class="list2"><a href="/index.php">' . $lang['back'] . '</a></div>';
}
elseif(!checkinvite($code)){
echo '<div class="list2">' . $lang['invalidinvite'] . '<br />
<a href="/register.php">' . $lang['back'] . '</a></div>';
}else{
$username = getarg('username');
$password = getarg('password');
$email = getarg('email');
if($username != NULL && $password != NULL && $email != NULL){
$errtext = '';
if(checkusername($username))
$errtext .= '' . $lang['userexists'] . '';
if(!checkemail($email))
$errtext .= '' . $lang['invalidemail'] . '';
if(strlen($password) < 5)
$errtext .= '' . $lang['invalidpassword'] . '';
$query=mysql_query("select * from `users` where `email`='".clean($email)."'");
if(mysql_num_rows($query) > 0)
$errtext .= '' . $lang['emailtaken'] . '';
if($errtext != ''){
echo $errtext;
echo '<div class="list2"><a href="/register.php?code=' . $code . '">' . $lang['back'] . '</a></div>';
}else{
if(adduser($username, $password, $email)){
$msub = $lang['regat'] . ' ' . $_SERVER['HTTP_HOST'];
$mmsg = $lang['username'] . ': ' . clean($username) . "rn" . $lang['password'] . ': ' . clean($password) . "rn" . $s_siteurl . '/' . "rn";
@mail($email, $msub, $mmsg, "From: $s_email <$s_email>rn");
removeinvite($code);
echo '<div class="list2">' . $lang['regsuccess'] . '</div>
<div class="list2">' . $lang['username'] . ': ' . clean($username) . '</div>
<div class="list2">' . $lang['password'] . ': ' . clean($password) . '</div>
<div class="list2"><a href="/login.php&username='.clean($username).'&password=' . clean($password) . '">' . $lang['continue'] . '</a></div>';
}
}
}else{
echo '<div class="list2">' . $lang['reginfo'][1] . '<br />
' . $lang['reginfo'][2] . '</div>';
echo tregisterbox($code);
echo '<div class="list2"><a href="/index.php">' . $lang['back'] . '</a></div>';
}
}
echo tfooter();
}
exit();
?>