Файл: Krimos/register.php
Строк: 255
<?php
// Криме / Krime
include('common.php');
if(islogged())
{
header('Location: ' . $s_siteurl . '/index.php?lang=' . $language);
}
else
{
echo theader();
if($s_inviteonly)
{
if($devel)
echo ' <span>' . $lang['develnote'] . ' <b>' . $s_megacode . '</b></span><br /><br />' . "rn";
$code = getarg('code');
if($code == $s_megacode)
{
$newcode = clean(getcode());
@mysql_query('INSERT INTO `invites` VALUES('0', '1', '' . $newcode . '');');
echo ' <span>' . $lang['uberaccepted'] . '</span><br />' . "rn";
echo ' <form method="get" action="' . $s_siteurl . '/register.php">' . "rn";
echo ' <input type="hidden" name="lang" value="' . $language . '" />' . "rn";
echo ' <input type="hidden" name="code" value="' . $newcode . '" />' . "rn";
echo ' <input type="submit" value="' . $lang['continue'] . '" /><br /><br />' . "rn";
echo ' </form>' . "rn";
}
elseif($code == NULL)
{
echo ' <span>' . $lang['inviteonly'] . '</span><br /><br />' . "rn";
echo tcodebox();
echo ' <span><a href="' . $s_siteurl . '/index.php?lang=' . $language . '">' . $lang['back'] . '</a></span><br /><br />' . "rn";
}
elseif(!checkinvite($code))
{
echo ' <span>' . $lang['invalidinvite'] . '</span><br />' . "rn";
echo ' <span><a href="' . $s_siteurl . '/register.php?lang=' . $language . '">' . $lang['back'] . '</a></span><br /><br />' . "rn";
}
else
{
$username = getarg('username');
$password = getarg('password');
$email = getarg('email');
if($username != NULL && $password != NULL && $email != NULL)
{
$errtext = '';
if(checkusername($username))
$errtext .= ' <span>' . $lang['userexists'] . '</span><br />' . "rn";
if(!checkemail($email))
$errtext .= ' <span>' . $lang['invalidemail'] . '</span><br />' . "rn";
if(strlen($password) < 5)
$errtext .= ' <span>' . $lang['invalidpassword'] . '</span><br />' . "rn";
$query = mysql_query('SELECT * FROM `users` WHERE `email` = '' . clean($email) . '';');
if(mysql_num_rows($query) > 0)
$errtext .= ' <span>' . $lang['emailtaken'] . '</span><br />' . "rn";
if($errtext != '')
{
echo $errtext;
echo ' <span><a href="' . $s_siteurl . '/register.php?lang=' . $language . '&code=' . $code . '">' . $lang['back'] . '</a></span><br /><br />' . "rn";
}
else
{
if(adduser($username, $password, $email))
{
$msub = $lang['regat'] . ' ' . $s_sitename;
$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 ' <span>' . $lang['regsuccess'] . '</span><br />' . "rn";
echo ' <span>' . $lang['username'] . ': ' . clean($username) . '</span><br />' . "rn";
echo ' <span>' . $lang['password'] . ': ' . clean($password) . '</span><br />' . "rn";
echo ' <span><a href="' . $s_siteurl . '/login.php?lang=' . $language . '&username=' . clean($username) . '&password=' . clean($password) . '">' . $lang['continue'] . '</a></span><br /><br />' . "rn";
}
}
}
else
{
echo ' <span>' . $lang['reginfo'][1] . '</span><br />' . "rn";
echo ' <span>' . $lang['reginfo'][2] . '</span><br /><br />' . "rn";
echo tregisterbox($code);
echo ' <br />' . "rn";
echo ' <span><a href="' . $s_siteurl . '/index.php?lang=' . $language . '">' . $lang['back'] . '</a></span><br /><br />' . "rn";
}
}
}
else
{
$username = getarg('username');
$password = getarg('password');
$email = getarg('email');
if($username != NULL && $password != NULL && $email != NULL)
{
$errtext = '';
if(checkusername($username))
$errtext .= ' <span>' . $lang['userexists'] . '</span><br />' . "rn";
if(!checkemail($email))
$errtext .= ' <span>' . $lang['invalidemail'] . '</span><br />' . "rn";
if(strlen($password) < 5)
$errtext .= ' <span>' . $lang['invalidpassword'] . '</span><br />' . "rn";
$query = mysql_query('SELECT * FROM `users` WHERE `email` = '' . clean($email) . '';');
if(mysql_num_rows($query) > 0)
$errtext .= ' <span>' . $lang['emailtaken'] . '</span><br />' . "rn";
if($errtext != '')
{
echo $errtext;
echo ' <span><a href="' . $s_siteurl . '/register.php?lang=' . $language . '&code=' . $code . '">' . $lang['back'] . '</a></span><br /><br />' . "rn";
}
else
{
if(adduser($username, $password, $email))
{
$msub = $lang['regat'] . ' ' . $s_sitename;
$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 ' <span>' . $lang['regsuccess'] . '</span><br />' . "rn";
echo ' <span>' . $lang['username'] . ': ' . clean($username) . '</span><br />' . "rn";
echo ' <span>' . $lang['password'] . ': ' . clean($password) . '</span><br />' . "rn";
echo ' <span><a href="' . $s_siteurl . '/login.php?lang=' . $language . '&username=' . clean($username) . '&password=' . clean($password) . '">' . $lang['continue'] . '</a></span><br /><br />' . "rn";
}
}
}
else
{
echo ' <span>' . $lang['reginfo'][1] . '</span><br />' . "rn";
echo ' <span>' . $lang['reginfo'][2] . '</span><br /><br />' . "rn";
echo tregisterbox($code);
echo ' <br />' . "rn";
echo ' <span><a href="' . $s_siteurl . '/index.php?lang=' . $language . '">' . $lang['back'] . '</a></span><br /><br />' . "rn";
}
}
echo tfooter();
}
exit();
?>