chris_rulez001 Posted July 29, 2007 Share Posted July 29, 2007 hi, my users cant seem to register, when they click sumbit its going to a blank white screen, can someone help me please? my code: <?php $id = $_POST['id']; $display = $_POST['title']; $email = $_POST['email']; $username = $_POST['username']; $password = $_POST['password']; $md5pass = md5(trim($password)); $cpassword = $_POST['cpassword']; $age = $_POST['age']; $ip=$_SERVER['REMOTE_ADDR']; $question = $_POST['question']; $answer = $_POST['answer']; $tos = $_POST['tos']; $sqlcheck="SELECT username FROM forumusers"; if ($username == "") { echo "<strong>Error:</strong><br> You havent entered your username<br/><br/>"; } elseif (strpos($username, $sqlcheck) === true) { echo "<strong>Error:</strong><br> The requested username is in use<br/><br/>"; } elseif ($display == "") { echo "<strong>Error:</strong><br> You havemt entered your desired display name<br/><br/>"; } elseif ($password == "") { echo "<strong>Error:</strong><br> You havent entered your password<br/><br/>"; } elseif (strpos($cpassword, $password) === FALSE) { echo "<strong>Error:</strong><br> You havent confirmed your password properly<br/><br/>"; } elseif ($email == "" || strpos($email, "@") === FALSE || strpos($email, ".") === FALSE) { echo "<strong>Error:</strong><br> You havent entered your email<br/><br/>"; } elseif ($age == "" || $age < 13) { echo "<strong>Error:</strong><br> You must be 13 or over to join<br/><br/>"; } elseif ($age == "Age (e.g. 14)" || $age == "") { echo "<strong>Error:</strong><br> You havent entered your age<br/><br/>"; } elseif ($answer == "") { echo "<strong>Error:</strong><br> You havent entered your forgotten password answer<br/><br/>"; } else { $location = "*****"; $mysqlusername = "**********"; $mysqlpassword = "************"; $database = "******************************"; $conn = mysql_connect("$location","$mysqlusername","$mysqlpassword"); if (!$conn) die ("Could not connect MySQL"); mysql_select_db($database,$conn) or die ("Could not open database"); $mysqlinsert="INSERT INTO forumusers(id, username, password, display, email, age, forgottenquestion, forgottenanswer, gender, ip)VALUES('$id', '$username', '$md5pass', '$display', '$email', '$age', '$question', '$answer', '$gender', '$ip')"; $result2=mysql_query($mysqlinsert); if($result2){ echo "<u><strong>Your Login Information</strong></u><br/><br/>"; echo "Your Registered Username Is: ".$username."<br/><br/>"; echo "Your Registered Password Is: ".$password."<br/><br/>"; echo "<u><strong>Other Information</strong></u><br/><br/>"; echo "Your Registered Email Is: ".$email."<br/><br/>"; echo "Your Registered Age Is: ".$age." Years Of Age<br/><br/>"; echo "Your Forgotten Password Question Is: ".$question."<br/><br/>"; echo "Your Forgotten Password Answer Is: ".$answer."<br/><br/>"; echo "You Are Successfully Registered, Click <a href='index.php'>Here</a>"; echo " To Go To The Homepage<br /> <br/><br/>"; echo "<div class='important'><strong><u>Write This Information Down</u></strong></div>"; } } ?> Quote Link to comment Share on other sites More sharing options...
dbillings Posted July 29, 2007 Share Posted July 29, 2007 Where's the html form that post's the data to your php script? Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted July 29, 2007 Author Share Posted July 29, 2007 sorry, here it is: <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <?php $host="**********"; // Host name $username="**********"; // Mysql username $password="**********"; // Mysql password $db_name="**********"; // Database name $tbl_name4="thunderboardforums"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql4="SELECT * FROM $tbl_name4 ORDER BY id DESC"; // OREDER BY id DESC is order result by descending $result4=mysql_query($sql4); $rows4 = mysql_fetch_array($result4); ?> <title><?php echo $rows4['forumtitle']; ?> - Register</title> <link rel="stylesheet" href="css/stylesheet.css" /> </head> <body text="000000" bgcolor="F1F1F1" link="003399" vlink="003399" alink="003399"> <?php $host="**********"; // Host name $username="**********"; // Mysql username $password="**********"; // Mysql password $db_name="**********"; // Database name $tbl_name="boards"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name ORDER BY id DESC"; // OREDER BY id DESC is order result by descending $result=mysql_query($sql); ?> <?php $host="**********"; // Host name $username="**********"; // Mysql username $password="**********"; // Mysql password $db_name="**********"; // Database name $tbl_name="forumusers"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql1="SELECT * FROM $tbl_name ORDER BY id DESC"; // OREDER BY id DESC is order result by descending $result1=mysql_query($sql1); ?> <br /> <table border="0" width="92%" cellspacing="0" cellpadding="0" style="border-color:#000000" align="center"> <tr> <td width="100%"> <table border="0" width="100%" cellpadding="0" cellspacing="0"> <tr> <td width="27%" height="50" align="center" bgcolor="F1F1F1" class="welcomebg"> </td> <td width="73%" bgcolor="F1F1F1" class="welcomebg" align="center"> <p><font size="2"> <?php if (!isset($_SESSION['username']) == false) echo "Welcome, ".$_SESSION['displayname'].""; else{ echo "Welcome, Guest, Please <a href='login.php'>Login</a> or <a href='register.php'>Register</a>"; }?><br/> <?php $date = date("l F d, g i a"); echo $date; ?> </font><br /></p> </td> </tr> </table> </td> </tr><tr> <td align="center"> <table width="100%" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="100%" align="center"> <table border="0" width="100%" cellpadding="3" cellspacing="0" align="center"> <tr> <td class="menubg" valign="middle" bgcolor="EFEFEF" align="center"><font size="1"> <a href="index.php">Home</a> <a href="help.php">Help</a> <a href="members.php">Members</a> <a href="profile.php">Profile</a><?php if ($rows1['user_level'] == "Administrator") echo " <a href='admin.php'>Admin Panel</a>"; else { echo ""; } ?> <?php if (!isset($_SESSION['username']) == false) echo "<a href='logout.php'>Logout</a>"; else{ echo "<a href='login.php'>Login</a> <a href='register.php'>Register</a>"; }?> </font></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <br /> <table width="92%" cellspacing="0" cellpadding="0" align="center"> <tr> <td valign="top" width="100%"> <br /> <a href="index.php" class="nav"><?php echo $rows4['forumtitle']; ?></a> :: Register <br/> <table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="000000" class="bordercolor"><tr><td><table cellpadding="4" cellspacing="1" border="0" width="100%"><tr> <td width="100%" class="titlebg" bgcolor="4080B0"><font size="2"><b>Register</b></font></td> </tr><tr> <td width="100%" class="windowbg" bgcolor="EFEFEF">Fields marked with a <font color="#FF0000">*</font> are required <form id='form1' name='form1' method='post' action='add_user.php'> <blockquote> <p><strong>General Information:</strong><br/> ---------------------------------------------------------------</p> <font color="#FF0000">*</font>Email: <input type='text' name='email' /> <br /> <br /> <font color="#FF0000">*</font>Date Of Birth: <input name='age' type='text' value='Age (e.g. 14)' /> <br /> <br /> <font color="#FF0000">*</font>Gender: <input type='text' name='gender' /> <br /> <br /> <font color="#FF0000">*</font>Display Name: <input type='text' name='title' /> <br /> <br /> <p><strong>Login Information:</strong><br/> ---------------------------------------------------------------------</p> <font color="#FF0000">*</font>Username: <input type='text' name='username' /> <br /> <br /> <font color="#FF0000">*</font>Password: <input type='password' name='password' maxlength='20' /> <br /> <br /> <font color="#FF0000">*</font>Password <br /> (confirm): <input name='cpassword' type='password' id='cpassword' maxlength='20' /> <br /> <br /> <p><strong>Other Information:</strong><br/> ---------------------------------------------------------------------</p> <font color="#FF0000">*</font>Forgotton Password Question: <input type='text' name='question' readonly='true' value='What do you do in your spare time?' size='36' /> <br /> <br /> <font color="#FF0000">*</font>Forgotton Password Answer: <input type='text' name='answer' /> <br /> <br /> <input name='tos' type='checkbox' id='tos' value='tos'/> By checking the box, you confirm that you agree to the <a href='../tos.php' style='color:#0000FF; background-color:#FFFFFF'>Terms of Service</a>. <br/><br/> <input name='id' type='hidden' value='id' /> <input type='submit' name='Submit' value='Submit' /> <input type='reset' name='Submit2' value='Reset' /> </p> </blockquote> </p> </blockquote> </form> </td> </tr></table> </td> </tr> </table></td></tr></table> <br/> <div align="center"><?php include('includes/copyright.php'); echo $hosted; ?></div> </body> </html> Quote Link to comment Share on other sites More sharing options...
dbillings Posted July 29, 2007 Share Posted July 29, 2007 Maybe someone else will be able to offer more help, but I would slide in the following bit and test. See if it throws you any error's. $result2=mysql_query($mysqlinsert)or die(mysql_error()); Make sure add_user.php is correct for your form action are they definately in the same directory? I don't see where you actually run the query for your sqlcheck. Hope you figure it out. Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted July 30, 2007 Author Share Posted July 30, 2007 yeah ive figured it out, i was querying the coloum display when in phpmyadmin it showed as displayname, and it works now. thanks for your help 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.