View file lost_pass.php

File size: 6.47Kb
<?

header("Cache-Control: no-cache");
$ver = empty($ver) || ($ver!='wml' && !file_exists('css/'.$ver.'.css')) ? 'xhtml' : $ver;
if ($ver=="wml") header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else header("Content-Type:text/html; charset=UTF-8");

$ref = rand(10000, 1000000);
require("inc.php");
$link = connect_db();

if(!isset($go)){
if ($ver=="wml"){
echo $xml;
echo $dtd;
echo "<wml>";
echo "<card id=\"cabinet\" title=\"Система восстановления пароля\">";
echo "<p align=\"center\">\n";
}else{
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/$ver.css\"/>";
echo "<title>Система восстановления пароля</title>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>";
echo "<div align=\"center\">";
echo "<form method=\"POST\" action=\"lost_pass.php?ver=$ver&amp;go=lost_pass&amp;$ses&amp;ref=$ref\" name=\"auth\">\n"; 
}
echo "<small>";
echo "Ник или ID:<br/>\n";
echo "</small>";
echo "<input name=\"nick\" maxlength=\"13\" title=\"lost_pass\"/><br/>\n";
echo "<small>";
echo "Транслитирация ника:<br/>\n";
echo "</small>";
echo "<select name=\"trun\">\n";
echo "<option value=\"0\">Нет</option>\n";
echo "<option value=\"1\">Да</option>\n";
echo "</select><br/>\n";
if ($ver=="wml"){
echo "<small>";
echo "<anchor title=\"go\">Выслать пароль<go href=\"lost_pass.php?ver=$ver&amp;go=lost_pass&amp;$ses&amp;ref=$ref\" method=\"post\">\n";
echo "<postfield name=\"nick\" value=\"$(nick)\"/>\n";
echo "<postfield name=\"trun\" value=\"$(trun)\"/>\n";
echo "</go></anchor>\n";
echo "</small>";
echo "<br/>";
}else{
echo "<input type=\"submit\" value=\"Выслать пароль\" name=\"enter\"><br/>\n";
}
if ($ver=="wml")echo "</p></card></wml>";
else echo "</div></body></html>";
mysql_close ($link);
exit;
}

if(@$go == "lost_pass"){       
if (!ctype_digit($nick)) {
if($trun==1)$nick=trun_to_rus($nick);
$nick=trim($nick);    
$post=trim($post);
if($nick=="")$nick=0;
$latuser=strtolower($nick);
$ruser = rus_to_k($nick);
if($ruser==$nick){
$select = mysql_query ("Select id,user,mail,pass from users where latuser = '".$latuser."'"); 
} else {
$select = mysql_query ("select id,user,mail,pass from users where ruser = '".$ruser."'");
}
} else {
$select = mysql_query ("select id,user,mail,pass from users where id = '".$nick."'");
}
if (mysql_affected_rows() == 0){
if ($ver=="wml"){
echo $xml;
echo $dtd;
echo "<wml>";
echo "<card id=\"error\" title=\"Ошибка\" ontimer=\"lost_pass.php?$ses&amp;ref=$ref\"><timer value=\"15\"/>";
echo "<p align=\"center\">";
}else{
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/$ver.css\"/>";
echo "<title>Ошибка</title>";
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"2; URL=lost_pass.php?ver=$ver&amp;$ses&amp;ref=$ref\">";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>";
echo "<div align=\"center\">";
}
echo "<small>";
echo "Юзер не найден. Возможно ник удалён.<br/>";
echo $divide;
echo "<a href=\"lost_pass.php?ver=$ver&amp;$ses&amp;rm=$rm&amp;ref=$ref\">Назад</a><br/>\n";
echo "</small>";
if ($ver=="wml")echo "</p></card></wml>";
else echo "</div></body></html>";
mysql_close ($link);
exit;	
}
$inf = mysql_fetch_array ($select);
$usid = $inf["id"];
$nick = $inf["user"];
$to = $inf["mail"];
$pass = $inf["pass"];

if ($ver=="wml"){
echo $xml;
echo $dtd;
echo "<wml>\n";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
echo "<card id=\"results\" title=\"Найдено\">\n";
echo "<p align=\"center\">\n";
}else{
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/$ver.css\"/>";
echo "<title>Найдено</title>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>";
echo "<div align=\"center\">";
}
if ($to==""){
echo "<small>";
echo "E-M@il при регистрации не заполнен.<br/>";
echo "Восстановление пароля невозможно.<br/>";
echo "</small>";
}else{
echo "<small>";
echo "Пароль выслан пользователю <b>".$nick."</b> на эл.почту ".$to.".<br/>";
echo "</small>";
$adds = "From: israclub.ru<israclub@mail.ru> \n"; 
$adds .= "X-sender: < israclub@mail.ru >\n";
$adds .= "Content-Type: text/plain; charset=koi8-r\n";  
@$to = str_replace(chr("13"), " ", $to);
@$to = str_replace(chr("10"), " ", $to);
@$to = str_replace("\\n", " ", $to);
@$to = str_replace(" ", "  ", $to);
@$to=substr($to,0,100);
@$to = str_replace("  ", " ", $to);
@$to=ereg_replace(" +"," ",$to);
@$to = trim(" $to ");
@$mail = str_replace(chr("13"), " ", $mail);
@$mail = str_replace(chr("10"), " ", $mail);
@$mail = str_replace("\\n", " ", $mail);
@$mail = str_replace(" ", "  ", $mail);
@$mail = str_replace("  ", " ", $mail);
@$mail=ereg_replace(" +"," ",$mail);
@$mail = trim(" $mail ");
@$mail = str_replace("", "", $mail);
@$mail = str_replace("", "", $mail); 
@$mail = str_replace("", "", $mail); 
@$mail = str_replace("", "", $mail); 
@$mail = str_replace("", "", $mail); 
@$mail = str_replace("", "", $mail); 
@$mail= str_replace("\\", "", $mail);
$now= date("j-m-Y");
$subject = "Система восстановления пароля чата VipClub";
$body = "$now \n Вы, или кто-нибудь другой, пытались восстановить пароль \n в чате http://bonpocob.net Пароль $pass, \n вы можете воспользоваться автологином http://bonpocob.net/enter.php?ver=$ver&amp;id=$usid&amp;ps=$pass";
$body = convert_cyr_string($body, 'w','k');
$subject = convert_cyr_string($subject, 'w','k');
mail($to,$subject,$body,$adds);
}
echo "<small>";
echo $divide;
echo "<a href=\"index.php?ver=$ver\">Главная</a><br/>\n";
echo "</small>";
if ($ver=="wml")echo "</p></card></wml>";
else echo "</div></body></html>";
mysql_close ($link);
exit;
}
?>