<?php
include ("../config.php");
$sql=mysql_query("select * from admin where username='".mysql_real_escape_string($_POST['username'])."' and password='".md5($_POST['password'])."'");
$num=mysql_num_rows($sql);
if ($num>0)
{
setcookie("username", $_POST['username']."~".md5($_POST['password']), time()+21600);
echo"<META HTTP-EQUIV='refresh' content='0; URL=index.php'>";
}
else
{
echo"<META HTTP-EQUIV='refresh' content='0; URL=index.php?error=yes'>";
}
?>