<?php
set_magic_quotes_runtime(0);
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) {
echo "<center><form action='../admin.php' method=post target='_parent'><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;
}
?>