function change_password($id, $password)
{
//generate a random password
$pass = "";
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
$i = 0;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
//change the password in the db
$sql = "update cust_info set cust_pw ='".md5($pass)."', temp_pass = 1 where cust_lg = '$id' and cust_pw = '$password'";
$result = connect($sql);
if ($result){
return $pass;
}else{
change_password($id, $password);
}
}//end function
SQL is case insensitive for most queries. but you can use UPPER or LOWER to force case to one or the other if you feel its a problem
for the html tag
http://www.robotstxt.org/wc/meta-user.html
bastien
From: "Ron Piggott" <ron.php@xxxxxxxxxxxxxxxxxx> To: "PHP DB" <php-db@xxxxxxxxxxxxx> Subject: Random Character String Date: Sat, 5 Mar 2005 09:38:35 -0500
Is there a way of generating an 8 character random string in PHP?
Is there a way to ignore UPPER and lower case when you are using the SELECT command to find a record in the mySQL table?
I know this isn't an HTML forum ... I have one more question which is more HTML in nature. I don't want some of the web pages to be indexed that my PHP scripts are creating. Is there a tag you know of to prevent this from happening?
Ron
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php