Jump to content


Photo

Change password


  • Please log in to reply
2 replies to this topic

#1 9911782

9911782
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts

Posted 27 July 2006 - 07:08 AM

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

#2 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 27 July 2006 - 07:49 AM

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

This is roughly how it works.

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#3 9911782

9911782
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts

Posted 11 August 2006 - 11:28 AM

;) thank very much

Its working for me now after along time.

thankx a million





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users