Jump to content

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/272559-password-reset-not-working/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.