Jump to content

Archived

This topic is now archived and is closed to further replies.

9911782

Change password

Recommended Posts

Hi There :)

Ps help me

Its goes like this, I have register all my users, then send them their username & password(temp), then what they need to do:

On my user table, I have a flag that I created to check if its the user's first time to login.
They will have to Login with username & password I gave them, then after that, the change password option shoul appear to them so that they can put their own password.

I have created the Login.php, Login_verify.php, then changepassword.php. On the changepassword.php,
I have this :
-------------------------------------------
<?php
if (isset($_POST["btnchangepass"])){
$changed = $_POST['Y'];
$password = $_POST['password'];
require_once('inc_conn.php');
$sql="SELECT * FROM users WHERE changed = 'N'";
//execute sql statements
$rsverify = mysql_query($sql, $connwmis) or die(mysql_error());
//retrieve one row of records
$rows_rsverify = mysql_fetch_array($rsverify);

if($changed == 'N'){
$updateSQL = "UPDATE users SET password=password('$password'), changed = '$changed' WHERE changed = 'N'";
$execute = mysql_query($updateSQL, $connwmis) or die(mysql_error());
//redirect to viewarticles
If ($execute) {
mysql_close($connwmis);
$msg ="Thank you for changing yout password.";
}
}
}
?>
------------------------------------------------------
But now, I have a problem, It not doing anything.No update nothing.
Another thing in the changepassword.php, what do I need to do actually, because to my understanding, I believe that I have to compare the newpassword ,re-enter newpassword, then from there I dont know what to do...

Ps help me 
Thank you

Share this post


Link to post
Share on other sites
[code]$sql="SELECT * FROM users WHERE changed = 'N'";[/code]
This part is wrong, you do WHERE username ='$username' AND password='$password'
then below you need to add
[code]if (rows_rsverify['changed'] == 0)
{
// Blah blah blah...
}[/code]

This is roughly how it works.

Share this post


Link to post
Share on other sites

×

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.