Clinton Posted January 8, 2009 Share Posted January 8, 2009 If I type in an incorrect password and then make it so the npword and vnpword do not match I would assume it would kick me back with the error that "Hey CHucklehead... the passwords don't match!" Instead it jumps straight to the "An error has encountered" section. I've jacked around with this for a while. What curly bracket is misplaced because I cannot figure it out *Bangs head against desk* <?php session_start(); include 'connect/project.htm'; if(($_SESSION['logged_in'] == 1) && ($_SESSION['access_type'] == e)) { $uid = mysql_real_escape_string($_SESSION['user_id']); $query = mysql_query("SELECT * FROM users WHERE username = '$uid'"); $row = mysql_fetch_assoc($query); extract($row); if (isset($_POST['submit'])) { $errors = array(); ///Checks Password/// if ((!empty($_POST['opword'])) && (!empty($_POST['npword'])) && (!empty($_POST['vnpword']))) { if ($_POST['npword'] != $_POST['vnpword']) { $$_SESSION['resultp'] = '<font color="red">The 2 passwords you have entered do not match.</font>'; header("Location: myinfo.php"); } elseif ($password != md5($_POST['opword'])) { $_SESSION['resultp'] = '<font color="red">Your old password was entered incorrectly. Try again.</font>'; header("Location: myinfo.php"); } else { $password = md5($_POST['npword']); } ///Confirms and Inserts/// if (empty($_SESSION['resultp'])) { $query = "UPDATE users SET password = '$password' WHERE username = '$uid'"; $result = mysql_query($query); } if (mysql_affected_rows() == 1) { $_SESSION['resultp'] = '<font color=lightgreen> Your password has been successfully changed.</font>'; header("Location: myinfo.php"); } else { $_SESSION['resultp'] = '<font color=red> An error was encountered. Please try again.</font>'; header("Location: myinfo.php"); } } else { $_SESSION['resultp'] = '<font color=red> Filling out at least one field would get you a little further then filling out none and hitting submit. :-)</font>'; header("Location: myinfo.php"); } }else { $_SESSION['resultp'] = '<font color=red>Ummmm... it seems like you are trying something un-kosher. I am watching. </font>'; header("Location: myinfo.php"); } } else { ?> <html> <head> <title>intelliPursuit: 10-31</title> <meta http-equiv="refresh" content="2;url=index.php" /> </head> <body> We have a 10-31. Login or face prosecution! </body> </html> <?php } ?> Quote Link to comment Share on other sites More sharing options...
timmah1 Posted January 8, 2009 Share Posted January 8, 2009 It look like your missing } on the check password <?php if ((!empty($_POST['opword'])) && (!empty($_POST['npword'])) && (!empty($_POST['vnpword']))) { if ($_POST['npword'] != $_POST['vnpword']) { $$_SESSION['resultp'] = '<font color="red">The 2 passwords you have entered do not match.</font>'; header("Location: myinfo.php"); } elseif ($password != md5($_POST['opword'])) { $_SESSION['resultp'] = '<font color="red">Your old password was entered incorrectly. Try again.</font>'; header("Location: myinfo.php"); } else { $password = md5($_POST['npword']); } } ?> Quote Link to comment Share on other sites More sharing options...
Clinton Posted January 8, 2009 Author Share Posted January 8, 2009 If I do that then the "Ummm...." part errors out near the bottom. Quote Link to comment Share on other sites More sharing options...
timmah1 Posted January 8, 2009 Share Posted January 8, 2009 What's the error your getting? Quote Link to comment Share on other sites More sharing options...
Clinton Posted January 8, 2009 Author Share Posted January 8, 2009 I figured it out... that second big IF statement was jacking me up. I didn't need it because if any of the other errors would have occurred it would have followed the header instead of completing the rest of the script. <?php session_start(); include 'connect/project.htm'; if(($_SESSION['logged_in'] == 1) && ($_SESSION['access_type'] == e)) { $uid = mysql_real_escape_string($_SESSION['user_id']); $query = mysql_query("SELECT * FROM users WHERE username = '$uid'"); $row = mysql_fetch_assoc($query); extract($row); if (isset($_POST['submit'])) { $errors = array(); ///Checks Password/// if ((!empty($_POST['opword'])) && (!empty($_POST['npword'])) && (!empty($_POST['vnpword']))) { if ($_POST['npword'] != $_POST['vnpword']) { $_SESSION['resultp'] = '<font color=red>The 2 passwords you have entered do not match.</font>'; header("Location: myinfo.php"); } elseif ($password != md5($_POST['opword'])) { $_SESSION['resultp'] = '<font color=red>Your old password was entered incorrectly. Try again.</font>'; header("Location: myinfo.php"); } else { $password = md5($_POST['npword']); $query = "UPDATE users SET password = '$password' WHERE username = '$uid'"; $result = mysql_query($query); $_SESSION['resultp'] = '<font color=lightgreen> Your password has been successfully changed.</font>'; header("Location: myinfo.php"); } } else { $_SESSION['resultp'] = '<font color=red> Please fill out all three fields.</font>'; header("Location: myinfo.php"); } } else { $_SESSION['resultp'] = '<font color=red>Ummmm... it seems like you are trying something un-kosher. I am watching. </font>'; header("Location: myinfo.php"); } } else { ?> <html> <head> <title>intelliPursuit: 10-31</title> <meta http-equiv="refresh" content="2;url=index.php" /> </head> <body> We have a 10-31. Login or face prosecution! </body> </html> <?php } ?> Quote Link to comment Share on other sites More sharing options...
timmah1 Posted January 8, 2009 Share Posted January 8, 2009 good. I was going to comment on this $$_SESSION['resultp'] = '<font color="red">The 2 passwords you have entered do not match.</font>'; header("Location: myinfo.php"); but it seems you got it Quote Link to comment Share on other sites More sharing options...
Clinton Posted January 8, 2009 Author Share Posted January 8, 2009 Yea, I only caught that AFTER I fixed the first problem. :-) Guess that's what happens when you've been starring at the screen for 11 hours. Thanks for the 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.