include 'includes/config.inc.php'; if (isset($_POST['create_user'])) { $doCreate = true; $error = ''; $username = isset($_POST['user_name']) ? $_POST['user_name'] : ''; $password = isset($_POST['user_pass']) ? $_POST['user_pass'] : ''; $password2 = isset($_POST['user_pass2']) ? $_POST['user_pass2'] : ''; $email = isset($_POST['email']) ? $_POST['email'] : ''; if (!$username) { $doCreate = false; $error = 'Please enter a user name'; } if (!$password || $password != $password2) { $doCreate = false; $error = 'Please make sure both passwords match'; } if ($doCreate) { $sql = "INSERT INTO user (userid, password, email) VALUES ('$username', '$password', '$email')"; $result = mysql_query($sql); if ($result) { $query = "SELECT * FROM user WHERE userid = '$username' AND password = '$password'"; $result = mysql_query($query); if (mysql_num_rows($result) != 0) { $sessionid = session_id(); mysql_query("UPDATE user SET session_id = '$sessionid' WHERE userid = '$username'"); } header("Location: /giftlist/"); } else { $error = 'User already exists'; } } if ($error) { echo "