mattm1712 Posted March 30, 2010 Share Posted March 30, 2010 can any1 help me this script just guves me a blank scrren i had it working then i add the bit where it tells the user there password has changed now it doesnt work plz help <?php session_start(); $user = $_SESSION['user']; If ($user) if ($_POST['submit']) { $oldpassword = md5($_POST['oldpassword']); $newpassword = md5($_POST['newpassword']); $repeatnewpassword = md5($_POST['repeatnewpassword']); echo "$oldpassword/$newpassword/$repeatnewpassword"; include 'connect.inc'; $queryget = mysql_query("SELECT pass FROM users WHERE name='$user'"); $row = mysql_fetch_assoc($queryget); echo $oldpassworddb."<br>"; echo $oldpassword."<br>"; $oldpassworddb =$row['password']; if ($oldpassword==$oldpassworddb) { if ($newpassword==$repeatnewpassword) { echo "pass changed"; } else die("pass dont match!"); } else { echo" <form action='newpass.php' method='POST'> Old password: <input type='text' name='oldpassword'><br> New password: <input type='password' name='newpassword'><br> Repeat password: <input type='password' name='repeatnewpassword'><br> <input type='submit' name='submit' value='change password'> </form> "; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/197045-change-password-help/ Share on other sites More sharing options...
dreamwest Posted March 30, 2010 Share Posted March 30, 2010 <?php session_start(); $user = $_SESSION['user']; if ($user){ if ($_POST['submit']){ $oldpassword = md5($_POST['oldpassword']); $newpassword = md5($_POST['newpassword']); $repeatnewpassword = md5($_POST['repeatnewpassword']); echo "$oldpassword/$newpassword/$repeatnewpassword"; include 'connect.inc'; $queryget = mysql_query("SELECT pass FROM users WHERE name='$user'"); $row = mysql_fetch_assoc($queryget); echo $oldpassworddb."<br>"; echo $oldpassword."<br>"; $oldpassworddb =$row['password']; if ($oldpassword==$oldpassworddb){ if ($newpassword==$repeatnewpassword) { echo "pass changed"; }else{ die("pass dont match!"); } }else{ echo "<form action='newpass.php' method='POST'> Old password: <input type='text' name='oldpassword'><br> New password: <input type='password' name='newpassword'><br> Repeat password: <input type='password' name='repeatnewpassword'><br> <input type='submit' name='submit' value='change password'> </form>"; } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/197045-change-password-help/#findComment-1034399 Share on other sites More sharing options...
mattm1712 Posted March 30, 2010 Author Share Posted March 30, 2010 hi i try using this code but i get this error Parse error: syntax error, unexpected $end in /home/sites/moseleyengineering.co.uk/public_html/matt/newpass.php on line 45 normally when i get errors like this i have missed brackets out but your code looks fine Quote Link to comment https://forums.phpfreaks.com/topic/197045-change-password-help/#findComment-1034401 Share on other sites More sharing options...
AdRock Posted March 30, 2010 Share Posted March 30, 2010 you are missing a closing } Quote Link to comment https://forums.phpfreaks.com/topic/197045-change-password-help/#findComment-1034416 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.