change info in database not successful
| From: | sgibbs at vt dot globalhealth dot org | Date: | Wed, 29 Aug 2001 18:46:48 +0000 |
| Subject: | change info in database not successful | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-65081@lists.php.net to get a copy of this message | ||
Good day everyone,
I'm writing because the username/password database table we had written for
us does not seem to be accepting changes to a password. When I make a
change, not only does the new password not take effect but it disables the
entire account making it useless)
Below is the code from the change.php3 file. I think the problem is
possibly being caused with the unset() function but I'm not sure....
Any ideas?
Thanks again for your help. Shawna
<? php3
if($n_password1 != $n_password2){
print "passwords do not match. try
again.";
exit;
};
$password1=$n_password1;
$username =
addslashes($n_username);
$name_prefix = addslashes($name_prefix);
$name_first =
addslashes($name_first);
$name_middle = addslashes($name_middle);
$name_last =
addslashes($name_last);
$name_suffix = addslashes($name_suffix);
$email =
addslashes($email);
$designation = addslashes($designation);
$title = addslashes($title);
$company =
addslashes($company);
if($newsletter != "y"){
$newsletter = "n";
};
(....not sure what is going on here.... )
if($id){
unset($password);
if($password1){
$password
= ", password = password('$password1')";
};
mysql_db_query("$db", "update members set username = '$username',
name_prefix = '$name_prefix', name_first = '$name_first', name_middle =
'$name_middle', name_last = '$name_last', name_suffix =
'$name_suffix',
email = '$email', designation = '$designation', title = '$title',
foodchain='$foodchain', company = '$company', newsletter =
'$newsletter'
$password where id = $id") || print
"FAILED.\n\n";
}else{
mysql_db_query("$db", "insert into members (id,
username, password,
foodchain, name_prefix, name_first, name_middle, name_last, name_suffix,
email, designation, title, company, newsletter) values(null, '$username',
password('$password1'), $foodchain, '$name_prefix', '$name_first',
'$name_middle', '$name_last', '$name_suffix', '$email',
'$designation',
'$title', '$company', '$newsletter')");
};
?>