Hello!
If you are good at PHP, please have a look at the code below:
This is a utility that is supposed to send you your forgotten
password. You just have to provide your username or email. However, I
have modified it so that if there are multiple members using the same
e-mail address in the database, the notification will be sent to each
one of them. Unfortunately, my modifications don't work and now this
code will not send the notification even once. Do you know what can be
wrong?
include('./config.inc.php');
$t = & new_smarty();
$vars = get_input_vars();
$login = $vars['login'];
if (!strlen($login)) {
$t->assign('login', $login);
$t->display('sendpass_failed.html');
exit();
};
$ul = $db->users_find_by_string($login, 'login', 1);
if (!count($ul)){
$l = $db->escape($login);
$q = $db->query("SELECT m.member_id, p.expire_date
FROM {$db->config[prefix]}members m LEFT JOIN
{$db->config[prefix]}payments p USING (member_id)
WHERE m.email='$l'
GROUP BY m.member_id
ORDER BY p.completed DESC, p.expire_date DESC
");
while (list($member_id, $expire) = mysql_fetch_row($q)){
$ul[] = $member_id ? array($db->get_user($member_id)) : array();
}
}
if ( count($ul) ){
foreach ($ul as $u){
$t->assign('login', $u['login']);
$t->assign('pass', $u['pass']);
$t->assign('email', $u['email']);
$t->assign('name_f', $u['name_f']);
$t->assign('name_l', $u['name_l']);
$t->assign('user', $u);
$msg = $t->fetch("sendpass.txt");
$admin_email = $config['admin_email'];
mail_customer($u['email'], $msg, "Password Remainder");
}
$t->display('sendpass_ok.html');
} else {
$t->assign('login', $login);
$t->display('sendpass_failed.html');
} |