Can anyone spot any problems with this? It's not returning any errors.
Expand|Select|Wrap|Line Numbers
- <?php
- // login2.php
- include("connect_courses.php");
- if(isset($_POST['Submit']) && $_POST['Submit'] == "Submit")
- {
- $myusername = $_POST['myusername'];
- $mypassword = $_POST['mypassword'];
- $mynewpassword = $_POST['mynewpassword'];
- $confirmnewpassword = $_POST['confirmnewpassword'];
- $result = mysql_query("SELECT password FROM users WHERE username='$myusername'");
- if(!$result)
- {
- echo "The username you entered does not exist. <a href=index.php>Try Again</a>";
- }
- else
- if($password!= mysql_result($result, 0))
- {
- echo "You entered an incorrect password. <a href=index.php>Try Again</a>";
- }
- else
- if($mynewpassword==$confirmnewpassword)
- $sql=mysql_query("UPDATE users SET password='$mynewpassword' where username='$myusername'");
- if($sql)
- {
- echo "Congratulations! You have successfully changed your password.";
- }
- else
- {
- echo "The new password and confirm new password fields must be the same. <a href=change_password_courses.php>Try Again</a>";
- } }
- ?>