Code: Select all
<?php
//Some standard checks
if (strcmp($_POST['password'], $_POST['cpassword']) != 0) header("Location: error.php?errno=4");
if (strlen($_POST['username']) < 3 || strlen($_POST['username']) > 18) header("Location: error.php?errno=5");
if (strlen($_POST['password']) < 5) header("error.php?errno=6");
if (strlen($_POST['email']) <= 0) header("error.php?errno=7");
if (ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $$_POST['email']) == FALSE) header("Location: error.php?errno=10");;
if (rows_query("SELECT username FROM user WHERE username = '$_POST[username]'") > 0) header("Location: error.php?errno=8");
$_POST['byear'] = "19" . $_POST['byear'];
if (checkdate($_POST['bmonth'], $_POST['bday'], $_POST['byear']) == FALSE) header("Location: error.php?errno=9");
$time = time(); //Joindate
$birthday = mktime(0, 0, 0, $_POST['bmonth'], $_POST['bday'], $_POST['byear']); //Make birthdate from input
$password = md5($_POST['password']);
$query = reg_query("INSERT INTO user (username, password, email, homepage, aim, icq, signature, joindate, birthdate, location, realname, favanime) VALUES ('$_POST[username]', '$password', '$_POST[email]', '$_POST[homepage]', '$_POST[aim]', '$_POST[icq]', '$_POST[signature]', '$time', '$birthday', '$_POST[location]', '$_POST[realname]', '$_POST[favanime]')");
//set a cookie to show they are registered (not really 'protection' from multiple signups)
$expiry = 60*60*24*365*100; //100years
setcookie("registered", "1", time()+$expiry, "/");
$page = new template("templates/register/done.html");
$page->$linkroot = "";
$page->CreatePage();
?>