<?php 
include "conn.php";   
//check data
if(!isset($_POST['username']))
{
header('Location:index.php');
}
session_register("emsg");
session_register("avalidlog");
session_register("username");
session_register("userid");
$query="SELECT 
id,
username,
pass FROM admin 
where username='$_POST[username]' and pass='$_POST[password]'";
$result=mysql_query($query,$eclipse);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
if($row==0)
{
$HTTP_SESSION_VARS["emsg"]="Invalid user please re-enter your username and password";
header('Location:index.php');
}
else
{
$_SESSION["avalidlog"]="true";
$_SESSION["username"]=$row['username'];
$_SESSION["userid"]=$row['id'];
header('Location:manager.php');
}
?>