<!DOCTYPE HTML 5> <html> <head> <title>Register</title> <link rel="stylesheet" type="text/css" href="812style.css"> </head> <body> <a href="index.php"><img src="logo.png"></a> </body> </html> <?php if(isset($_SESSION['user_id'])) { $url = 'http://812402.com/812/index.php'; header ( 'Location: $url' ); } if(isset($_POST['submitted'])) { require ('XXX'); if (isset($_POST['username'])) { $un = escape_data ($_POST[username]); } else { echo '<p align="center"><font color="red"><b>Please enter a username!</b></font color></p>'; } if($_POST['age'] >'7') { $age = escape_data($_POST[age]); } else { echo '<p align="center"><font color="red">You are to young to be using this site.</font color></p>'; } if(isset($_POST['password'])) { } else { echo '<p align="center"><font color="red"><b>Please enter a password!</b></font color></p>'; } if(isset($_POST['password2'])) { if($_POST['password'] == $_POST['password2']) { $pw = escape_data($_POST[password]); } else { echo '<font color="red"><b>The two passwords must match!</b></font color>'; } } else { echo '<font color="red"><b>Please enter a confirming password!</b></font color>'; } if (isset($_POST['email'])) { $e = escape_data($_POST[email]); } else { echo '<p align="center><font color="red">Please enter your email/parents email!</font color></p>'; } if ($u && $pw && $age && $e) { $query = "SELECT FROM 'XXX' 'XXX' WHERE email='$e'"; $result = 'mysql_query ($query) or trigger_error("Error:" mysql_error())'; $query2 = "SELECT FROM 'XXX' 'XXX' WHERE username='$u'"; $result2 = 'mysql_query ($query2) or trigger_error("Error:" mysql_error())'; $query3 = "SELECT FROM 'XXX' 'XXX' WHERE password='$pw'"; $result3 = 'mysql_query ($query3) or trigger_error("Error:" mysql_error())'; } else { echo '<p align="center"><font color="red">Sorry, but you could not be registered. Please try again later.</font color></p>'; } if (mysql_num_rows($result) == 0) { $eav = "true"; } else { $eav = "false"; echo '<p align="center">The email is already taken</p>'; } if (mysql_num_rows($result) == 0) { $uav = "true"; } else { $uav = "false"; echo '<p align="center">The username is already taken.</p>'; } if (mysql_num_rows($result2) == 0) { $pav = "true"; } else { $pav = "false"; echo '<p aliagn="center">The password is already taken</p>'; } if ($eav && $uav && $pav == "true") { echo '<h4 align="center">Thanks for registering! An email has been sent to you that will activate your account.<h4>'; $a = md5(uniqid(rand(), true)); $query = "INSERT INTO 'XXX' 'XXX' (username, password, email, age, role, active, date_registered) VALUES ('$u', '$pw', '$e, '$age', '1', '$a', NOW() )"; $result = 'mysql_query ($query) or trigger_error(Error mysql_error())'; $body = 'Thank you for registering! Your activation link is http://812402.com/812/activate.php?id=". mysql_insert_id() . "code=$a"'; mail($_POST['email'], 'Confirm Email', $body); } else { echo 'Please try again.'; }}; ?> <form action="register.php" method="post" action="register.php"> <h4 align="center">username</h4><p align="center"><input type="text" maxlength="45" name="username"></p> <h4 align="center">password</h4><p align="center"><input type="password" name="password" maxlength="50"></p> <h4 align="center">confirm password</h4><p align="center"><input type="password" name="password2" maxlength="50"></p> <h4 align="center">email/parents email</h4><p align="center"><input type="text" name="email" maxlength="50"></p> <h4 align="center">age <p align="center"> <select name="age"> <option value="3">3 <option value="4">4 <option value="5">5 <option value="6">6 <option value="7">7 <option value="8" selected>8 <option value="9">9 <option value="10">10 <option value="11">11 <option value="12">12 <option value="13">13+ </select></p> <input type="hidden" name="submitted" value="TRUE"> <p align="center"><input type="submit" value="Join!"></p> </form> PHP: There's no error message, but it works weird. It's suppost to be a user registration script. Click here to see the page.
Why you have two action attributes in the form? <form action="register.php" method="post" action="register.php"> HTML: Also: There is an error, but since its black on black, its impossible to see it. Fatal error: Call to undefined function escape_data() in /home/content/14/7688814/html/812/register.php on line 29 Code (markup): You have not defined escape_data() anywhere in the script.
Its a syntax error, Check and make sure you have not missed a semicolon, in a line before. Also note that this error is in "config.php" Parse error: syntax error, unexpected T_IF, expecting '{' in /home/content/14/7688814/html/812/config.php on line 14 Code (markup):