Doc20 Posted June 12, 2011 Share Posted June 12, 2011 Hey everyone, I am in a bit of a bind... again. I have been working on this project for a few weeks now, and I have a user registration that accompanies a log in script. Well, it was working -- could register new users, and everything.. Well tonight, I went back to test the page again (I don't remember why), and it was not adding the new user account. I have the script set up to go to another page that runs a series of checks, and if successful has a mysql script to insert a new row into the database. I also have a series of alert boxes (using Javascript) that would tell the user the status of things. Here is the registration form code (found on the following page: http://www.pwnstargaming.com/doc/wos/register.php) <form id="register" name="register" method="post" action="registerprocess.php"> <hr size="5" /> <p align="left"> If you are interested in holding an account on this system, please fill out the following form!<br /> <br /> <em>For the confirmation, please type in, '<strong>pwnstardoc</strong>' (without the quote marks) </em><br /> <br /> <input id="ip" name="ip" value='<?php echo $_SERVER["REMOTE_ADDR"]?>' type='hidden'> <strong>Username:</strong> <input type="text" name="username" /> </p> <p align="left"><strong>Desired Password:</strong> <input type="password" name="password" /> <br /> <br /> <strong>Repeat Password:</strong> <input type="password" name="password2" /> </p> <p align="left"><strong>Xfire Address:</strong> <input type="text" name="xfire" /></p> <p align="left"><strong>Anti-Spam Confirmation:</strong> <input type="text" name="confirmation" /></p> <p align="left"> <input type="submit" name="submit" id="submit" value="Submit Registration" /> <br /> <em>Disclaimer: IP Address will be collected upon successful registration. </em></p> </form> And the processing script code <?php ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); include ("db.php"); if ($_POST['submit'] == "Submit Registration") { if ($_POST['password'] == $_POST['password2']) { // if passwords match if ($_POST['confirmation'] == "pwnstardoc") { $insert_user="INSERT INTO users (username, password, ip, xfire) VALUES ('$_POST[username]','$_POST[password]','$_POST[ip]',$_POST[xfire])" or die ("not submitted"); if (mysql_query($insert_user)) { echo " <script type='text/javascript'> alert(\"You have been successfully registered! You will be redirected to the log-in page now.\"); </script> "; echo "<meta HTTP-EQUIV='REFRESH' content='0; url=login.php'>"; } else { echo " <script type='text/javascript'> alert(\Registration failed! Please go back and try again!\"); </script> "; /*echo "<meta HTTP-EQUIV='REFRESH' content='0; url=registerfail.php'>"; */ } } else { /*echo "confirmation bad"; */ echo " <script type='text/javascript'> alert(\"Confirmation code was not entered correctly! Please go back and re-read the instructions, and enter the code correctly. Please click OK to go back to the registration form!\"); </script> "; echo "<meta HTTP-EQUIV='REFRESH' content='0; url=registercode.php'>"; } } else { /*echo "password bad"; */ echo " <script type='text/javascript'> alert(\"Your desired passwords did not match one another! Please go back and carefully re-type your desired passwords. Please click OK to go back to the registration form!\"); </script> "; echo "<meta HTTP-EQUIV='REFRESH' content='0; url=registerpass.php'>"; } } ?> Currently the page is just going to the processing page as a blank page (even with error reporting turned on). It doesn't even do a pop up box - like it used to. The part of the code that has '/*echo "<meta HTTP-EQUIV='REFRESH' content='0; url=registerfail.php'>"; */' is where the issue is (that else statement).. I changed most of my refreshes to dead pages to see where it failed -- ie. registerfail.php does not exist. However, if I take that part of the code out of comment lines, and try and register, it redirects to this page. So I know that it is failing to execute the mysql $insert_user query (from the if statement above). However, it doesn't even throw the popup box from that section of the code..... Does anyone have any pointers on what to do? I do not believe I have done anything since the time this page worked and now, with it not working. I even added a die() at the end of the query to see if it would give me an error, it doesn't. I am lost.... Link to comment https://forums.phpfreaks.com/topic/239127-registrations/ Share on other sites More sharing options...
Doc20 Posted June 12, 2011 Author Share Posted June 12, 2011 After some time on Google, I found some users that were having the same problem. Not getting any errors with the INSERT INTO function, but no row was added. I even tried to remake the registration page, and gave a die message to appear when successful. include ("db.php"); // database connection $register_new = "INSERT INTO `users` VALUES ('','$username','$password','$xfire','$ip','0')"; } die ("You have been successfully registered!"); I get the success message, but nothing is actually inserted into the table. I deleted the table and recreatedit , same thing -- no new data inserted. Maybe this new bit of info helps if anyone has had problems with this before? Link to comment https://forums.phpfreaks.com/topic/239127-registrations/#findComment-1228674 Share on other sites More sharing options...
Doc20 Posted June 12, 2011 Author Share Posted June 12, 2011 Nevermind, I found my own error. Was missing a set of single quote marks.. Link to comment https://forums.phpfreaks.com/topic/239127-registrations/#findComment-1228752 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.