<html>
<head>
<title>Восстановление пароля</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<style type="text/css">
<!--
.text {font: 11px Tahoma; color: #333333}
body,table {font-family: MS Sans Serif; font-size: 8pt}
input, select, textarea {font-size: 8pt; font-family: MS Sans Serif; border: black 1px solid}
small {font-size: 8pt; background-color: #E0E0E0; font-weight: bold}
a {text-decoration: none; color: 333333}
a:vlink {text-decoration: none; color: 333333}
a:alink {text-decoration: underline; color: 333333}
a:hover {text-decoration: underline; color: 333333}
ul {color: #00B1F6; margin-left: 20px}
li {margin-bottom: 15px}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#FFFFFF" text="#000000" class="text">

<?
if ($_POST['rmail']){
$r2mail=$_POST['rmail'];
@include("./../inc/config.php");
if (safe_login($r2mail)==0){$aut_error .= "<br><br>Некорректные символы в почтовом адресе.";}
@include("./../inc/info.php");
@$sql=mysql_query("SELECT * FROM `m3_users` WHERE `mail` = '$r2mail' LIMIT 1;") or die (mysql_error());
if(!empty($sql)){
while($row = @mysql_fetch_array($sql, MYSQL_ASSOC)){
if ($r2mail == $row['mail']){
$n_pass=MakePass(8);
$message="Login: ".$row[login]."
New password: ".$n_pass."
".$WWW."m3_moder/";
@include("./../inc/smtp.php");
$mail =& Mail::factory('smtp', array('host' => $smtp_host, 'port' => 25, 'auth' => true, 'username' => $smtp_user, 'password' => $smtp_pass));
$hdrs = array('From' => $mail_from, 'Subject' => 'Retrive password on '.$WWW);
@$mail->send($r2mail, $hdrs, $message);
$aut_error .= "<br><br>На указанный вами почтовый адрес<br>были высланы забытые реквизиты.";
@mysql_query("UPDATE `m3_users` SET `passwd` = '".md5($n_pass)."' WHERE `mail` = '$r2mail' LIMIT 1;");
}else{$aut_error .= "<br><br>Почтовый адрес не найден в базе.";}
}}
@mysql_free_result($sql);
@include("./../inc/info.php");
exit;}
?>

<table cellpadding="0" cellspacing="0" width="100%" height="100%">
    <tr>
        <td width="100%">
	 <form name="retrive" action="loss.php" method="post">
            <table align="center" style="border-collapse:collapse;" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="18" style="border-top-width:1; border-bottom-width:1; border-left-width:1; border-top-color:black; border-bottom-color:black; border-left-color:black; border-top-style:solid; border-bottom-style:solid; border-left-style:solid;" bgcolor="#999999">
                        <p align="right"><img src="../m3_images/user.gif" width="16" height="16" border="0"></p>
                    </td>
                    <td width="200" style="border-top-width:1; border-right-width:1; border-bottom-width:1; border-top-color:black; border-right-color:black; border-bottom-color:black; border-top-style:solid; border-right-style:solid; border-bottom-style:solid;" bgcolor="#999999">
                        <p><b><font color="white">Восстановление пароля</font></b></p>
                    </td>
                </tr>
                <tr>
                    <td style="border-top-width:1; border-right-width:1; border-bottom-width:1; border-left-width:1; border-color:black; border-style:solid;" bgcolor="#CCCCCC" colspan="2">
                        <table align="center" cellpadding="0" cellspacing="0" width="180">
                            <tr>
                                <td>
                                        <p>&nbsp;</p>
                                </td>
                                <td>

                                        <p>&nbsp;</p>
                                </td>
                            </tr>
                            <tr>
                                <td height="22">
                                    <p>&nbsp;<b>E-Mail:</b></p>
                                </td>
                                <td>

                                        <p align="right"><input type="text" name="rmail" maxlength="50" size="24"></p>

                                </td>
                            </tr>
                                <tr>
                                <td>
                                        <p>&nbsp;</p>
                                </td>
                                <td height="40">

                                        <p align="right"><input type="submit" name="enter" value="Восстановить"></p>
                                </td>
                                </tr>
                        </table>
                    </td>
                </tr>
             </table>

            <table align="center" cellpadding="0" cellspacing="0" width="218">
                <tr>
                    <td>
                        <p align="right"><font size="1"><span class="text">
</p>
                    </td>
                </tr>
            </table>
	    </form>
        </td>
    </tr>
</table>