Can someone please help me?
I'm getting the following error, in the following script.
Fatal error: Cannot redeclare makerandompassword() (previously declared in /home/infamous/public_html/password.php:27) in /home/infamous/public_html/password.php on line 25
<?
require ("clients/inc/config.php");
$sql = "SELECT * FROM users WHERE status = 'test'";
$result = mysql_query($sql);
if (!$result)
{
echo mysql_error();
}
else
{
if (mysql_num_rows($result) < 1)
{
echo "0 users!";
}
else
{
while ($user = mysql_fetch_assoc($result))
{
$subject = "Client Management System";
$from = "infamous91@yahoo.com";
function makeRandomPassword()
{
$salt = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789";
srand((double)microtime()*1000000);
$i = 0;
while ($i <= 8)
{
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$password = makeRandomPassword();
$message = "Hi, $user[fname],
This email is intended to inform you about our new client management system. You can login and manage all aspects of your web hosting account via the CMS.
Here are the login details for the CMS.
Your Username: $user[email]
Your password : $password
If you have any questions or concerns, please submit a support request by logging into the client management systems. If you're unable to login or unable to create a support request, please e-mail support at [email]infamous91@yahoo.com[/email].
Thank You,
";
mail ($user[email], $subject, $message, "From: $from");
$email = $user[email];
$password = md5($password);
$q = "UPDATE users SET password = '$password' WHERE email = '$email'";
$r = mysql_query($q);
if (!$r)
{
echo mysql_error();
}
}
}
}
?>