I found a change password script but i need to modify it to change the password in the "profiles" table and the "password " the username row is "username" row. Here is the code:

// This is downloaded from www.plus2net.com //
/// You can distribute this code with the link to www.plus2net.com ///
//  Please don't  remove the link to www.plus2net.com ///
// This is for your learning only not for commercial use. ///////
//The author is not responsible for any type of loss or problem or damage on using this script.//
/// You can use it at your own risk. /////

include "config.php";
<!doctype html public "-//w3c//dtd html 3.2//en">


<title>(Type a title for your page here)</title>




if(isset($todo) and $todo=="change-password"){

//Setting flags for checking
$status = "OK";


if ( strlen($password) < 3 or strlen($password) > 8 ){
$msg=$msg."Password must be more than 3 char legth and maximum 8 char lenght<BR>";
$status= "NOTOK";}					

if ( $password <> $password2 ){
$msg=$msg."Both passwords are not matching<BR>";
$status= "NOTOK";}					

echo "<font face='Verdana' size='2' color=red>$msg</font><br><center><input type='button' value='Retry' onClick='history.go(-1)'></center>";
}else{ // if all validations are passed.
if(mysql_query("update plus_signup set password='$password' where userid='$_SESSION[userid]'")){
echo "<font face='Verdana' size='2' ><center>Thanks <br> Your password changed successfully. Please keep changing your password for better security</font></center>";
}else{echo "<font face='Verdana' size='2' color=red><center>Sorry <br> Failed to change password Contact Site Admin</font></center>";



Recommended Answers

All 2 Replies

Then you have some work to do
this is a help forum, not a do it for you forum,
gets very tiresome

offer a form with old password, new passowrd and retype password. If old password matched the current db password and new pass and retyped pass match then update db to reflect new password!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.