Posted on Sunday 9th November 2008 at 05:57 PM
PHP Code
<? // Include data base connection include("dbconnect.php"); // Check for form submission if(isset($_REQUEST['submit'])) { // Check for empty fields if(empty($_REQUEST['username'])||empty($_REQUEST['password'])||empty($_REQUEST['cpassword'])||empty($_REQUEST['email'])) { // Cancel the register process and display error echo "Some fields are not filled out."; } else { // If fields are not empty // Set varibles for submitted data $username = $_REQUEST['username']; $password = $_REQUEST['password']; $cpassword = $_REQUEST['cpassword']; $email = $_REQUEST['email']; $ip = $_SERVER['REMOTE_ADDR']; } // Check if username already exists $sql1 = "SELECT * FROM `user` WHERE `username`='$username'"; $result1 = mysql_num_rows($result); if($result1 == 1) { //If username exists echo "Username already exists."; } // Check if submitted passwords are the same if($password != $cpassword) { //Passwords do not match, display error echo "Passwords do not match."; } // If username does not exist and passwords match // Encrypt password for database storage $spw = md5($password); // Insert data into database $sql2 = "INSERT INTO `users` (`username`,`password`,`email`,`ip`) VALUES ('$username','$spw','$email','$ip')"; $query1 = mysql_query($sql2); // Redirect if query runs correctly header("location: https://requiemofdestiny.awardspace.com/confirmed.php"); // Change to whatever you want the redirected apge to be ?>
Parse error: parse error, unexpected $ in /home/www/requiemofdestiny.awardspace.com/register.php on line 48
It's annoying...