jayuhazie Posted December 31, 2012 Share Posted December 31, 2012 This was working and now stopped? Any help would be great!! <?php require_once('../Connections/quantum_hub.php'); ?> <?php //Establish output variable - For displaying Error Messages $msg = ""; //Check to see if the form has been submitted if (mysql_real_escape_string($_POST['submit'])): //Establish Post form variables $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $npassword = mysql_real_escape_string($_POST['npassword']); $rpassword = mysql_real_escape_string($_POST['rpassword']); // Connect to the database mysql_select_db($database_quantum_hub, $quantum_hub) or die(mysql_error()); // Query the database - To find which user we're working with $sql = "SELECT * FROM users WHERE userLogin = '$username' "; $query = mysql_query($sql); $numrows = mysql_num_rows($query); //Gather database information while ($rows = mysql_fetch_array($query)): $dbusername = $rows['userLogin']; $dbpassword = $rows['userPassword']; $dbfirstname = $rows ['userFirstName']; $dblastname = $rows ['userLastName']; $email = $rows ['userEmail']; endwhile; //Validate The Form if (empty($username) || empty($password) || empty($npassword) || empty($rpassword)): $msg = "All fields are required"; elseif ($numrows == 0): $msg = "This username does not exist"; elseif ($password != $dbpassword): $msg = "The CURRENT password you entered is incorrect."; elseif ($npassword != $rpassword): $msg = "Your new passwords do not match"; elseif ($npassword == $password): $msg = "Your new password cannot match your old password"; else: //$msg = "Your Password has been changed."; mysql_query("UPDATE users SET userPassword = '$npassword' WHERE userLogin = '$username'"); $to = $email; $subject = "YOUR PASSWORD HAS BEEN CHANGED"; $message = "Hello $dbfirstname $dblastname. You've received this E-Mail because you have requested a PASSWORD CHANGE. If you did not submit a password change request, and believe this account modification to be fraudulant, please Quantum IT Support at 717-123-45678"; $from = "admin@qita.com"; $headers = "From: $from"; //Mails the username and unencrypted password to the user mail($to,$subject,$message,$headers); endif; endif; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Quantum: Hub</title> <link href="hub-style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main_container"> <div id="header"> </div> <div id="body_container"><div id="breadcrumbs">Extranet : <a href="main-menu.php" class="header_links">Main</a> : <span class="header_red">Change Password</span></div> <form method="POST" action="index.php"> <p> </p> <p> </p> <table width="433" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#000000"> <tr> <td align="right" bgcolor="#A80532" class="form_headers_white">Logon:</td> <td><input name="username" type="text" id="username" size="25" maxlength="25" /></td> </tr> <tr> <td align="right" bgcolor="#A80532" class="form_headers_white">Current Password:</td> <td><input name="password" type="password" id="password" size="25" maxlength="25" /></td> </tr> <tr> <td align="right" bgcolor="#A80532" class="form_headers_white">New Password:</td> <td><input name="npassword" type="password" id="npassword" size="25" maxlength="25" /></td> </tr> <tr> <td align="right" bgcolor="#A80532" class="form_headers_white">Confirm New Password:</td> <td><input name="rpassword" type="password" id="rpassword" size="25" maxlength="25" /></td> </tr> <tr> <td bgcolor="#A80532" class="style4 SubText"> </td> <td> <input type="submit" name="submit" id="submit" value="Change Password"/></td> </tr> </table> </form> </div> <div id="home_footer"><img src="grfx/footer.png" width="990" height="46" /></div> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 31, 2012 Share Posted December 31, 2012 1. Use code tags. 2. Check for SQL errors. 3. Do some debugging on your own and find the actual part that isn't working. 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.