Noskiw Posted December 19, 2008 Share Posted December 19, 2008 i have made a new registration page because my other website went down. but my page won't work on my new website either <?php session_start(); include'./global.php'; ?> <html> <head> <title>My Blog</title> <link rel="stylesheet" href="./style3.css" type="text/css" /> </head> <body> <div id="container"> <div id="header"> <center><h1>Register</h1></center> <?php if($_SESSION['uid']){ echo "<p>Your Logged In</p>"; }else { echo "<p>Welcome, <b>Guest</b>! | <a href=\"./reg.php\">Register</a> | <a href=\"./login2.php\">Login</a></p>"; } ?> </div> <div id="content"> <?php $step = $_GET['step']; if(!$step) { echo "<form action=\"./reg.php?step=2\" method=\"POST\"><table border=\"0\">\n"; echo "<tr><td>Name: </td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>Username: </td><td><input type=\"text\" name=\"username\"></td></tr>\n"; echo "<tr><td>Password: </td><td><input type=\"password\" name=\"password\"></td></tr>\n"; echo "<tr><td>Email: </td><td><input type=\"text\" name=\"email\"></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"Register\"></td></tr>\n"; } $errors = array(); $name = $_POST['name']; $username = $_POST['username']; $password = $_POST['password']; $email = $_POST['email']; $name = mysql_real_escape_string($name); $name = stripslashes($name); $username = mysql_real_escape_string($username); $username = stripslashes($username); $password = mysql_real_escape_string($password); $password = stripslashes($password); $email = mysql_real_escape_string($email); $email = stripslashes($email); if($step == "2") { if(!$name) { $errors[] = "You did not supply your <b>Name</b>!"; }else { if(!$username) { $errors[] = "You did not supply a <b>Username</b>!"; }else { if(!$password) { $errors[] = "You did not supply a <b>Password</b>!"; }else { if(!$email) { $errors[] = "You did not supply an <b>Email</b> address!"; }else { if(strlen($name) < 3) { $errors[] = "Your <b>Name</b> is to short!"; }else { if(strlen($name) > 32) { $errors[] = "Your <b>Name</b> is to long!"; }else { if(strlen($username) < 3) { $errors[] = "Your <b>Username</b> is to short!"; }else { if(strlen($username) > 32) { $errors[] = "Your <b>Username</b> is to long!"; }else { if(strlen($password) < 3) { $errors[] = "Your <b>Password</b> is to short!"; }else { if(strlen($password) > 64) { $errors[] = "Your <b>Password</b> is to long!"; }else { if(strlen($email) < 3) { $errors[] = "Your <b>Email</b> is to short!"; }else { if(strlen($email) > 64) { $errors[] = "Your <b>Email</b> is to long!"; }else { $sql1 = "SELECT * FROM users WHERE name = '".$name."'"; $res1 = mysql_query($sql1) or die(mysql_error()); if(mysql_num_rows($res1) > 0) { $errors[] = "The name <b>". $name . "</b> is already registered!"; }else { $sql2 = "SELECT * FROM users WHERE email = '".$email."'"; $res2 = mysql_query($sql2) or die(mysql_error()); if(mysql_num_rows($res2) > 0) { $errors[] = "The email address <b>'".$email."'</b> is already in use!"; }else { $sql4 = "SELECT * FROM users WHERE username='".$username"'"; $res4 = mysql_query($sql4)or die(mysql_error()); if(mysql_num_rows($res4) > 0){ $error[] = "The <b>Username</b> is already in use!\n"; } } } } } } } } } } } } } } } if(count($errors) > 0) { echo "The Following Errors Occurred!<br>\n"; foreach($errors AS $error) { echo $error . "<br>\n"; } }else { $sql3 = "INSERT INTO users (name, username, password, email) VALUES ('$name', '$username', '$password', '$email')"; $res3 = mysql_query($sql3) or die(mysql_error()); echo "You have successfully registered, and you may now login\n"; } } ?> </div> </div> </body> </html> cant find anything wrong. Quote Link to comment Share on other sites More sharing options...
premiso Posted December 19, 2008 Share Posted December 19, 2008 How is it "not working" ? What is it doing/not doing? Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted December 19, 2008 Share Posted December 19, 2008 You didn't end the form is one problem. What page is this register.php?step=2 or what? edit: i dont think you ended the table either for that matter second edit: shouldn't the include be: <?php include("./global.php"); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.