bobleny Posted February 17, 2007 Share Posted February 17, 2007 Hi, I had a few questions about this sign up script that I was hoping you could answer! I felt the easiest way to explain what is going on and ask my questions, was to use comments in the script it's self. So, if you wouldn't mind reading through the script real quick and answering some of my questions, I would be very great full! Also, please feel free to point out any mistakes or make suggestions that will make my script better.... Thanks! <?php session_start(); $database_hostname = "localhost"; $database_username = "root"; $database_password = ""; # Connect to my database. mysql_connect($database_hostname, $database_username, $database_password); # At this point I would like to know # if it was able to connect to the database. # How do I do that? # Select database. mysql_select_db("testy"); # Again, I would like to know # if it was able to select the database. # It should be the same as above, right? # This next part I am trying to check to # see if the username the person entered # is taken. # Is there a better way of doing this? $query = mysql_query("SELECT 'name' FROM 'users' WHERE 'name' = '" . $_POST['sign_username'] . "'"); if (!$query) # So, if there is no query, then the username # must not be taken... So I think... { if($_POST['sign_password'] == $_POST['sign_varpassword']) # If the 2 passwords entered match... { $md5 = md5($_POST['sign_password']); $sign_password = SHA1($md5); # Yes, I know md5(SHA1($pass)) is redundant! $sign_username = $_POST['sign_username']; $sign_lvl = "Super Noob"; $sign_date = date('l, F jS\, Y'); # I can't get this part to work! # It sets the session and works the function # but it wont insert anything into the database. # What is wrong with it? mysql_query("INSERT INTO 'users' (`name`, `password`, `level`, `signup`, `id`) VALUES ('" . $sign_username . "', '" . $sign_password . "', '" . $sign_level . "', '" . $sign_date . "' , )"); mysql_close(); $_SESSION['now_sign'] = TRUE; sendem(signup, .1); } else { $_SESSION['wrong_sign_password'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_username'] = TRUE; sendem(signup, .1); } ?> Thanks! Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 17, 2007 Author Share Posted February 17, 2007 Don't forget about me! Quote Link to comment Share on other sites More sharing options...
JJohnsenDK Posted February 17, 2007 Share Posted February 17, 2007 i would do this part deferently: mysql_query("INSERT INTO 'users' (`name`, `password`, `level`, `signup`, `id`) VALUES ('" . $sign_username . "', '" . $sign_password . "', '" . $sign_level . "', '" . $sign_date . "' , )"); mysql_close(); like this: $result = mysql_query("INSERT INTO 'users' SET `name` = '" . $sign_username . "', `password` =, '" . $sign_password . "' `level` = '" . $sign_level . "', `signup` = '" . $sign_date . "'"); mysql_close(); Anything but this looks good to me... Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted February 17, 2007 Share Posted February 17, 2007 Sorry,I may be wrong here but try this out. Change this: $query = mysql_query("SELECT 'name' FROM 'users' WHERE 'name' = '" . $_POST['sign_username'] . "'"); to this: $username=$_POST['username'] $query = mysql_query("SELECT name FROM users WHERE name = '$username'" And this: "INSERT INTO 'users' (`name`, `password`, `level`, `signup`, `id`) VALUES ('" . $sign_username . "', '" . $sign_password . "', '" . $sign_level . "', '" . $sign_date . "' , )"); mysql_close(); To this: $SQL="INSERT INTO `users` (`name`, `password`, `level`, `signup`, `id`) VALUES ("' . $sign_username . "', '" . $sign_password . "', '" . $sign_level . "', now() )"; $res=mysql_query($sql)or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 17, 2007 Author Share Posted February 17, 2007 JJohnsenDK, your suggestion didn't work... Greaser9780, I got no idea what you are suggesting... Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted February 17, 2007 Share Posted February 17, 2007 In the code you providing it is showing single quotes around your table name- 'users' - it should be backtics like this `users`. You only want single quotes for your values. The other part I put in about mysql_error was just to show you if there was an error in the query. Then it will tell you what was wrong. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 17, 2007 Share Posted February 17, 2007 you suggested using this: $username=$_POST['username'] how do you no thats what the users text field is called, by there code t should be this: $username=$_POST['sign_username'] here is the code with the answered questions: <?php session_start(); $database_hostname = "localhost"; $database_username = "root"; $database_password = ""; # Connect to my database. if(!mysql_connect($database_hostname, $database_username, $database_password)){ echo "Failed to connect!"; exit; } # At this point I would like to know # if it was able to connect to the database. # How do I do that? #A: Just use an if statement, it returns false if it fails. # Select database. if(!mysql_select_db("testy")){ echo "Failed to select database."; exit; } # Again, I would like to know # if it was able to select the database. # It should be the same as above, right? #A: Use an if statement again. # This next part I am trying to check to # see if the username the person entered # is taken. # Is there a better way of doing this? #A: First i would check if they entered a username. Then basicly like you've done except get the number of rows or you can get the affected rows. $username = $_POST['sign_username']; if($username == ""){ echo "You need a username!"; exit; } $query = mysql_num_rows(mysql_query("SELECT `name` FROM `users` WHERE `name`='{$username}'")); if ($query == 0) # I changed it, so if there are no rows the username is available. { if($_POST['sign_password'] == $_POST['sign_varpassword']) # If the 2 passwords entered match... { $md5 = md5($_POST['sign_password']); $sign_password = SHA1($md5); # Yes, I know md5(SHA1($pass)) is redundant! $sign_username = $_POST['sign_username']; $sign_lvl = "Super Noob"; $sign_date = date('l, F jS\, Y'); # I can't get this part to work! # It sets the session and works the function # but it wont insert anything into the database. # What is wrong with it? # Is the ID field an auto-increment, because it should be, if it is you dont need to write it in. if(!mysql_query("INSERT INTO `users` (`name`, `password`, `level`, `signup`) VALUES ('{$sign_username}','{$sign_password}','{$sign_lvl}', now())")){ echo "Query failed!"; exit; } mysql_close(); $_SESSION['now_sign'] = TRUE; sendem(signup, .1); } else { $_SESSION['wrong_sign_password'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_username'] = TRUE; sendem(signup, .1); } ?> there may be some i missed out on, sorry but see if that works. Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 18, 2007 Author Share Posted February 18, 2007 oooo! Thanks ProjectFear, this is great! I haven't tried it yet though.... I had a question about it though, what does the "now()" do in the following line?: "if(!mysql_query("INSERT INTO `users` (`name`, `password`, `level`, `signup`) VALUES ('{$sign_username}','{$sign_password}','{$sign_lvl}', now())"))" Thanks again! Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 18, 2007 Author Share Posted February 18, 2007 Oh, and also, why is it that you changed the $_POST['sign_usermane'] into a standard variable? Do $_POST[''] variables give php a hard time? Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 18, 2007 Author Share Posted February 18, 2007 Oh, and why do you use squiggly brackets around the variables in the querys? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 18, 2007 Share Posted February 18, 2007 lol. 1. now() just gets the current date and time... 2. no they dont, i dont think, i just made it like that because its easier to read. 3. they just seperate variables from normal text, you dont have to do it like that but its good with arrays because if you dont sometimes you get errors. Quote Link to comment Share on other sites More sharing options...
superuser2 Posted February 18, 2007 Share Posted February 18, 2007 #1: use this: <?php mysql_select_db("thedb") or die(mysql_error()); ?> same for connection. The next one I think you figured out on your own. It looks good to me but does it work now? Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 18, 2007 Author Share Posted February 18, 2007 No, it still isn't working... I am having the same problem but thanks to everyones help, I am getting near the end of this dang problem. Now, this code here is still giving me a problem... The problem with this script, <?php if(!mysql_query("INSERT INTO `users` (`name`, `password`, `level`, `signup`) VALUES ('{$sign_username}','{$sign_password}','{$sign_level}','{$sign_date}'")) { $_SESSION['error_message'] = mysql_error(); mysql_close(); sendem(error, .1); } else { mysql_close(); $_SESSION['now_sign'] = TRUE; sendem(signup, .1); } ?> When I arrive at the error page, I receive this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 What does this mean? If you need to see the entire script, I can show you, but you wont like it! And again, I am very great full for any and all help! Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 18, 2007 Author Share Posted February 18, 2007 Here is the same thing I gave you above but after I modifyed it, with your help of course! <?php if(!mysql_connect($database_hostname, $database_username, $database_password)) { sendem(error, .1); } if(!mysql_select_db("testy")) { sendem(error, .1); } if($_POST['sign_username'] == "") { echo "You need a username!"; } $query = mysql_query("SELECT `name` FROM `users` WHERE `name`='{$_POST['sign_username']}'"); $rows = mysql_num_rows($query); if ($rows == 0) { if($_POST['sign_password'] == $_POST['sign_varpassword']) { $md5 = md5($_POST['sign_password']); $sign_password = SHA1($md5); $sign_username = $_POST['sign_username']; $sign_lvl = "Super Noob"; $sign_date = date('l, F jS\, Y'); if(!mysql_query("INSERT INTO `users` (`name`, `password`, `level`, `signup`) VALUES ('{$sign_username}','{$sign_password}','{$sign_level}','{$sign_date}'")) { $_SESSION['error_message'] = mysql_error(); mysql_close(); sendem(error, .1); } else { mysql_close(); $_SESSION['now_sign'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_password'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_username'] = TRUE; sendem(signup, .1); } ?> Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 18, 2007 Author Share Posted February 18, 2007 Ok, Please ignore the last two posts! I have continued to modify the script and this seems even more accurate but I still don't understand.... This is there error message: Access denied for user 'www-data'@'localhost' (using password: NO) This is my little thingy to tell me about what line the error has occurred at: Line: 153 This is the surrounding area of line: 153: <?php if(!mysql_query("INSERT INTO `users` (`name`, `password`, `level`, `signup`) VALUES ('{$sign_username}','{$sign_password}','{$sign_level}','{$sign_date}'")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 153"; mysql_close(); sendem(error, .1); } else { mysql_close(); $_SESSION['now_sign'] = TRUE; sendem(signup, .1); } ?> This is the latest version of the script I am working on: <?php if(!mysql_connect($database_hostname, $database_username, $database_password)) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 111"; mysql_close(); sendem(error, .1); } if(!mysql_select_db("testy")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 119"; mysql_close(); sendem(error, .1); } if(!$query = mysql_query("SELECT `name` FROM `users` WHERE `name`='{$_POST['sign_username']}'")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 127"; mysql_close(); sendem(error, .1); } if(!$rows = mysql_num_rows($query)) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 135"; mysql_close(); sendem(error, .1); } if ($rows == 0) { if($_POST['sign_password'] == $_POST['sign_varpassword']) { $md5 = md5($_POST['sign_password']); $sign_password = SHA1($md5); $sign_username = $_POST['sign_username']; $sign_lvl = "Super Noob"; $sign_date = date('l, F jS\, Y'); if(!mysql_query("INSERT INTO `users` (`name`, `password`, `level`, `signup`) VALUES ('{$sign_username}','{$sign_password}','{$sign_level}','{$sign_date}'")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 153"; mysql_close(); sendem(error, .1); } else { mysql_close(); $_SESSION['now_sign'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_password'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_username'] = TRUE; sendem(signup, .1); } ?> Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 18, 2007 Share Posted February 18, 2007 your not connecting to your database, seems you have incorrect values or something. Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 18, 2007 Author Share Posted February 18, 2007 I think I see the problem... would the following if statement hold true if $rows = "0"? if(!$rows = mysql_num_rows($query)) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 135"; mysql_close(); sendem(error, .1); } Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 18, 2007 Share Posted February 18, 2007 that wouldn't return much actually. try it like this, assuming $rows is equal to 0. if($rows == mysql_num_rows($query)) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 135"; mysql_close(); sendem(error, .1); } or you could just check to see if mysql_num_rows($query) == 0. Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 18, 2007 Author Share Posted February 18, 2007 I retract my last statement, I don't believe that is the problem, maybe a problem, but not the problem... <?php if(!mysql_connect($database_hostname, $database_username, $database_password)) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 111"; mysql_close(); sendem(error, .1); } ?> If it was a connection error, "Line:" would return 111, but it didn't, it returned 153. Because it returned 153, the error pertains to this part here: <?php if(!mysql_query("INSERT INTO `users` (`name`, `password`, `level`, `signup`) VALUES ('{$sign_username}','{$sign_password}','{$sign_level}','{$sign_date}'")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 153"; mysql_close(); sendem(error, .1); } ?> This tells me then, I am loosing connection some where between the initial MySQL connect and the query... That is when I thought maybe, if "!$rows" is the same as saying "$row = 0". This made me think that maybe this was being executed: <?php if(!$rows == mysql_num_rows($query)) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 135"; mysql_close(); sendem(error, .1); } ?> However, if that was the case, "Line: 135" would have appeared. Because it did not, then everything is OK, and I have connection even at this point. Because I have connection at this point, the only thing left is this, which is where the script tells me the problem is: <?php if ($rows == 0) { if($_POST['sign_password'] == $_POST['sign_varpassword']) { $md5 = md5($_POST['sign_password']); $sign_password = SHA1($md5); $sign_username = $_POST['sign_username']; $sign_lvl = "Super Noob"; $sign_date = date('l, F jS\, Y'); if(!mysql_query("INSERT INTO `users` (`name`, `password`, `level`, `signup`) VALUES ('{$sign_username}','{$sign_password}','{$sign_level}','{$sign_date}'")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 153"; mysql_close(); sendem(error, .1); } else { mysql_close(); $_SESSION['now_sign'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_password'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_username'] = TRUE; sendem(signup, .1); } ?> Now, because I have no problem until that point, my question is, what is wrong? Quote Link to comment Share on other sites More sharing options...
superuser2 Posted February 18, 2007 Share Posted February 18, 2007 Can we see your whole modified code? It appears either you don't have a connection or you do but mysql_query isn't accessing it. Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 18, 2007 Author Share Posted February 18, 2007 This is the latest version of the script I am working on: <?php if(!mysql_connect($database_hostname, $database_username, $database_password)) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 111"; mysql_close(); sendem(error, .1); } if(!mysql_select_db("testy")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 119"; mysql_close(); sendem(error, .1); } if(!$query == mysql_query("SELECT `name` FROM `users` WHERE `name`='{$_POST['sign_username']}'")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 127"; mysql_close(); sendem(error, .1); } if(!$rows == mysql_num_rows($query)) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 135"; mysql_close(); sendem(error, .1); } if ($rows == 0) { if($_POST['sign_password'] == $_POST['sign_varpassword']) { $md5 = md5($_POST['sign_password']); $sign_password = SHA1($md5); $sign_username = $_POST['sign_username']; $sign_lvl = "Super Noob"; $sign_date = date('l, F jS\, Y'); if(!mysql_query("INSERT INTO `users` (`name`, `password`, `level`, `signup`) VALUES ('{$sign_username}','{$sign_password}','{$sign_level}','{$sign_date}'")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 153"; mysql_close(); sendem(error, .1); } else { mysql_close(); $_SESSION['now_sign'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_password'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_username'] = TRUE; sendem(signup, .1); } ?> Quote Link to comment Share on other sites More sharing options...
superuser2 Posted February 18, 2007 Share Posted February 18, 2007 Not sure if you said this already, but could you copy and paste what, exactly, mysql_error() returns? You've told us it was a connection error but could you please copy and paste the exact wording? Thanks. Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 18, 2007 Author Share Posted February 18, 2007 Ok, Please ignore the last two posts! I have continued to modify the script and this seems even more accurate but I still don't understand.... This is there error message: Access denied for user 'www-data'@'localhost' (using password: NO) This is my little thingy to tell me about what line the error has occurred at: Line: 153 This is the surrounding area of line: 153: <?php if(!mysql_query("INSERT INTO `users` (`name`, `password`, `level`, `signup`) VALUES ('{$sign_username}','{$sign_password}','{$sign_level}','{$sign_date}'")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 153"; mysql_close(); sendem(error, .1); } else { mysql_close(); $_SESSION['now_sign'] = TRUE; sendem(signup, .1); } ?> This is the latest version of the script I am working on: <?php if(!mysql_connect($database_hostname, $database_username, $database_password)) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 111"; mysql_close(); sendem(error, .1); } if(!mysql_select_db("testy")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 119"; mysql_close(); sendem(error, .1); } if(!$query = mysql_query("SELECT `name` FROM `users` WHERE `name`='{$_POST['sign_username']}'")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 127"; mysql_close(); sendem(error, .1); } if(!$rows = mysql_num_rows($query)) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 135"; mysql_close(); sendem(error, .1); } if ($rows == 0) { if($_POST['sign_password'] == $_POST['sign_varpassword']) { $md5 = md5($_POST['sign_password']); $sign_password = SHA1($md5); $sign_username = $_POST['sign_username']; $sign_lvl = "Super Noob"; $sign_date = date('l, F jS\, Y'); if(!mysql_query("INSERT INTO `users` (`name`, `password`, `level`, `signup`) VALUES ('{$sign_username}','{$sign_password}','{$sign_level}','{$sign_date}'")) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 153"; mysql_close(); sendem(error, .1); } else { mysql_close(); $_SESSION['now_sign'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_password'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_username'] = TRUE; sendem(signup, .1); } ?> Quote Link to comment Share on other sites More sharing options...
superuser2 Posted February 18, 2007 Share Posted February 18, 2007 You have quite a few mysql_close's around your script. Most likley one of them is running when it shouldn't. Use your editor's edit->find and comment out all of the mysql_close's in your script. Does it work now? Quote Link to comment Share on other sites More sharing options...
bobleny Posted February 18, 2007 Author Share Posted February 18, 2007 Superuser2, you are correct. After I fixed my little error setup, I found that this if statement is proving true: <?php $rows = mysql_num_rows($query); if(!$rows) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 136"; mysql_close(); sendem(error, .1); die(); } ?> The server is not returning a mysql error! So, I haven't the slightest idea what is wrong with it. What other types of error functions can I use? Again, here is the latest version after the fix: <?php if($_SESSION['now_sign'] == FALSE) { if($_SESSION['wrong_sign_password'] == TRUE) { $_SESSION['wrong_sign_password'] = FALSE; echo "Your passwords did not match! Remember, your password is case sensitive! \r\n <br /> \r\n"; echo "Please try again... \r\n <br /> \r\n"; } elseif($_SESSION['wrong_sign_username'] == TRUE) { $_SESSION['wrong_sign_username'] = FALSE; echo "I'm sorry, that usermane is already taken. \r\n <br /> \r\n"; echo "Please try again... \r\n <br /> \r\n"; } else { echo "In order to start useing the site forum and all of the site goodies you must be signed up. To do so, simply fill out the forum below. Your password is case sensitive! \r\n <br /> \r\n"; } echo "<form action='index.php?page=signup' method='post'> \r\n"; echo "Username: <input type='text' name='sign_username' size='21' maxlength='10'> \r\n <br /> \r\n"; echo "Password: <input type='password' name='sign_password' size='21' maxlength='20'> \r\n <br /> \r\n"; echo "Verify Password <input type='password' name='sign_varpassword' size='21' maxlength='20'> \r\n <br /> \r\n"; echo "<input type='submit' value='Sign Up'> \r\n"; echo "</form>"; } if($_SESSION['now_sign'] == TRUE) { $_SESSION['now_sign'] = FALSE; echo "Congratulations, you are now signed up! You are now being redirected! \r\n <br /> <br /> \r\n <a href='index.php?page=home'>If you are not automaticly redirected in 10 seconds, please click here.</a> \r\n"; sendem(home, 5); } if(isset($_POST['sign_username']) == TRUE) { $connect = mysql_connect($database_hostname, $database_username, $database_password); if(!$connect) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 106"; mysql_close(); sendem(error, .1); die(); } $selectdb = mysql_select_db("testy"); if(!$selectdb) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 116"; mysql_close(); sendem(error, .1); die(); } $query = mysql_query("SELECT `name` FROM `users` WHERE `name`='{$_POST['sign_username']}'"); if(!$query) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 126"; mysql_close(); sendem(error, .1); die(); } $rows = mysql_num_rows($query); if(!$rows) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 136"; mysql_close(); sendem(error, .1); die(); } if ($rows == 0) { if($_POST['sign_password'] == $_POST['sign_varpassword']) { $md5 = md5($_POST['sign_password']); $sign_password = SHA1($md5); $sign_username = $_POST['sign_username']; $sign_lvl = "Super Noob"; $sign_date = date('l, F jS\, Y'); $query = mysql_query("INSERT INTO `users` (`name`, `password`, `level`, `signup`) VALUES ('{$sign_username}','{$sign_password}','{$sign_level}','{$sign_date}'"); if(!$query) { $_SESSION['error_message'] = mysql_error(); $_SESSION['error_location'] = "Line: 156"; mysql_close(); sendem(error, .1); die(); } else { mysql_close(); $_SESSION['now_sign'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_password'] = TRUE; sendem(signup, .1); } } else { $_SESSION['wrong_sign_username'] = TRUE; sendem(signup, .1); } } ?> Thanks! 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.