<?php
// we check if everything is filled in
if(empty($_POST['fname']) || empty($_POST['lname']) || empty($_POST['email']) || empty($_POST['pass']))
{
die('{status:0,txt:"All the fields are required"}');
}
// is the sex selected?
if(!(int)$_POST['sex-select'])
{
die('{status:0,txt:"You have to select your sex"}');
}
// is the birthday selected?
if(!(int)$_POST['day'] || !(int)$_POST['month'] || !(int)$_POST['year'])
{
die('{status:0,txt:"You have to fill in your birthday"}');
}
// is the email valid?
if(!(preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $_POST['email'])))
die('{status:0,txt:"You haven\'t provided a valid email"}');
// Here you must put your code for validating and escaping all the input data,
// inserting new records in your DB and echo-ing a message of the type:
// echo '{status:1,txt:"/member-area.php"}';
// where member-area.php is the address on your site where registered users are
// redirected after registration.
//Database Information
/*$dbhost = “localhost”;
$dbname = “city”;
$dbuser = “city”;
$dbpass = “city”;
//Connect to database
mysql_connect ( $dbhost, $dbuser, $dbpass)or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$name = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$nickname = $_POST['nickname'];
$password =$_POST['password'];
// lets check to see if the username already exists
$query = "INSERT INTO users (name, lname, email, nickname, password)
VALUES('$name', '$lname', '$email', '$nickname', '$password')";
echo $query;
exit; */
echo '{status:1,txt:"registered.html"}';
echo $name = $_POST['fname'];
echo $lname = $_POST['lname'];
echo $email = $_POST['email'];
echo $nickname = $_POST['nickname'];
echo $password = md5($_POST['password']);
?>