per1os Posted June 15, 2007 Share Posted June 15, 2007 <?php $id = $_POST['id']; $email = $_POST['email']; $first = $_POST['nameFirst']; $last = $_POST['nameLast']; $username = $_POST['username']; $password = $_POST['password']; $md5pass = md5(trim($password)); // see here $cpassword = $_POST['cpassword']; $age = $_POST['age'] ; $gender = $_POST['gender'] ; $ip=$_SERVER['REMOTE_ADDR']; $sqlcheck="SELECT username FROM users WHERE username='$username'"; if ($first == "") { echo "<strong>Error:</strong><br> You havent entered your first name<br/><br/>"; } elseif ($last == "") { echo "<strong>Error:</strong><br> You havent entered your last name<br/><br/>"; } elseif ($username == "") { echo "<strong>Error:</strong><br> You havent entered your username<br/><br/>"; } elseif (strpos($username, $sqlcheck) === FALSE) { echo "<strong>Error:</strong><br> The requested username is in use<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/>"; } else { include ('includes/mysql_connect_users.php'); // also note the change to the statement below $mysqlinsert="INSERT INTO users(id, username, password, email, firstname, lastname, age, gender, ip)VALUES('$id', '$username', '$md5pass', '$email', '$first', '$last', '$age', '$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 "You Are Successfully Registered, Click <a href='index.php'>Here</a><br/>"; echo " To Go To The Homepage"; echo "<div class='important'><strong><u>Write This Information Down</u></strong></div>"; } } ?> That will fix the user registration portion, you still need to fix the current data. Quote Link to comment https://forums.phpfreaks.com/topic/55590-solved-help-with-login-confirm/page/2/#findComment-275288 Share on other sites More sharing options...
chris_rulez001 Posted June 15, 2007 Author Share Posted June 15, 2007 thanks but what about it saying invalid password when im typing the right password? Quote Link to comment https://forums.phpfreaks.com/topic/55590-solved-help-with-login-confirm/page/2/#findComment-275297 Share on other sites More sharing options...
per1os Posted June 15, 2007 Share Posted June 15, 2007 I dunno man, you have all the information to fix it just in this thread alone. You can catch a fish for a man and feed him for one day, or you can teach a man how-to fish and feed him for life. It just takes a little bit of logical thinking. Quote Link to comment https://forums.phpfreaks.com/topic/55590-solved-help-with-login-confirm/page/2/#findComment-275307 Share on other sites More sharing options...
atomicrabbit Posted June 15, 2007 Share Posted June 15, 2007 I dunno man, you have all the information to fix it just in this thread alone. You can catch a fish for a man and feed him for one day, or you can teach a man how-to fish and feed him for life. It just takes a little bit of logical thinking. yeah just use the registration fix that frost posted and create a new user (start from scratch), then try to log in with that new user. Who knows, it could have even been a typo when you typed the original password. If anything, retrieve the md5 password from the database, print it to the page. Then print the password you just typed into the box onto the page, but first md5() the typed password, then you can see if the passwords are different... they shouldn't be. It's all about realizing you have a problem and debugging the problem. You have to know what the problem is first. If you're just saying it's giving me an invalid password error, you don't know the reason to that. Figure it out, print both md5 passwords to the page and see if they match, if not, you probably did not enter the same password. And in that case, just rewrite the right password to the table Quote Link to comment https://forums.phpfreaks.com/topic/55590-solved-help-with-login-confirm/page/2/#findComment-275317 Share on other sites More sharing options...
chris_rulez001 Posted June 15, 2007 Author Share Posted June 15, 2007 thanks for your help everyone ill try and fix it the password problem Quote Link to comment https://forums.phpfreaks.com/topic/55590-solved-help-with-login-confirm/page/2/#findComment-275351 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.