Jump to content

Change password


9911782

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
Link to comment
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.
Link to comment
Share on other sites

  • 3 weeks later...
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.