case'lostpassword':
function sendnewpassword($mail)
{
global $lang;
$ExistMail = doquery("SELECT `email` FROM {{table}} WHERE `email` = '". $mail ."' LIMIT 1;", 'users', true);
if (empty($ExistMail['email']))
{
message($lang['mail_not_exist'], "index.php?modo=claveperdida",2, false, false);
}
else
{
$Caracters="aazertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN1234567890";
$Count=strlen($Caracters);
$NewPass="";
$Taille=6;
srand((double)microtime()*1000000);
for($i=0;$i<$Taille;$i++)
{
$CaracterBoucle=rand(0,$Count-1);
$NewPass=$NewPass.substr($Caracters,$CaracterBoucle,1);
}
$Title = $lang['mail_title'];
$Body = $lang['mail_text'];
$headers .= "MIME-Version: 1.0\n";
$headers .="Content-Type: multipart/mixed;\n";
$headers .= "From: $from_name <$from_mail>\n";
$encoding = 'windows-1251';
$multipart .= "Content-Type: text/html; charset=$encoding\n";
$multipart .= "Content-Transfer-Encoding: Quot-Printed\n\n";
$Body .= $NewPass;
mail($mail,$Title,$Body,$multipart, $headers);
$NewPassSql = md5($NewPass);
$QryPassChange = "UPDATE {{table}} SET ";
$QryPassChange .= "`password` ='". $NewPassSql ."' ";
$QryPassChange .= "WHERE `email`='". $mail ."' LIMIT 1;";
doquery( $QryPassChange, 'users');
}
}
if($_POST)
{
sendnewpassword($_POST['email']);
message($lang['mail_sended'], "./",2, false, false);
}
else
{
$parse['forum_url'] = $game_config['forum_url'];
display(parsetemplate(gettemplate('public/lostpassword'), $parse), false, '',false, false);
}
break;