<?php
include ("txt/vars.php");
if (isset($_POST['logine'])) {
$logine=$_POST['logine'];
}
else {

if (isset($_COOKIE['logine'])) {
$logine=$_COOKIE['logine'];
}
else {
$logine="";
}

}
$login=md5($logine);
if (isset($_POST['passe'])) {
$passe=$_POST['passe'];
}
else {

if (isset($_COOKIE['passe'])) {
$passe=$_COOKIE['passe'];
}
else {
$passe="";
}

}
$pass=md5($passe);
$link=mysql_connect("$mysqlhost","$mysqllogin","$mysqlpass") or die("Could not connect");
mysql_select_db($mysqldb) or die("Could not select database");
$query="select name,pass,status from admins where (status='admin' and name='$login' and pass='$pass')";
$res=mysql_query($query);
$num_rows=mysql_num_rows($res);
if ($num_rows>0) {
SetCookie ("logine",$logine);
SetCookie ("passe",$passe);
}
if ($num_rows<=0) {
echo "<center><form action=admin.php method=post><table cellpadding=4 cellspacing=1 border=0  width=25% bgcolor=#D3D3D3><tr bgcolor=white><td>";
echo "Логин:</td><td><center><input type=text name=logine size=25></td></tr><tr bgcolor=white><td>";
echo "Пароль:</td><td><center><input type=password name=passe size=25></td></tr><tr bgcolor=white><td colspan=2><center>";
echo "<input type=submit value='Войти в админ-панель'></td></tr></table>";
echo "</form>";
exit;
}
?>
<HTML><HEAD><TITLE>Hope-auction Administration</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1251">
</HEAD>
<FRAMESET border=0 frameSpacing=0 rows=* frameBorder=yes cols=180,*>
<FRAME name=nav marginWidth=3 marginHeight=3 src="admin/index.php">
<FRAME name=main marginWidth=10 marginHeight=10 src="admin/ad_menu.php">
</FRAMESET></HTML>
