<?php
session_start();
error_reporting(0);
?>
<?php
require 'include/configurations.php'; // ITECHBIDS Configuration File
require 'include/argvs.php'; // ITECHBIDS Configuration File
require 'include/header_index.php'; 
$cansave=$_POST['cansave'];
if($cansave==1)
{
$name=$_POST['txtName'];
$pswd=$_POST['txtPswd'];
$scode=$_POST['txtSeccode'];
$scod=$_POST['seccode'];
$name = seccheck($name);
$pswd = seccheck($pswd);
$sql="select * from admin where user_name='$name' and password='$pswd'";
$res=mysql_query($sql);
$num=mysql_num_rows($res);

if($num>0)
{
$_SESSION['adminuser']=$name;
$_SESSION['adminpass']=$pswd;
echo '<meta http-equiv="refresh" content="0;url=home.php">';
exit();
}
else
{
if($num<=0)
$message="Username and password doesnt match";
else
$message="Invaild TuringCode";
}
}
?>
                       <form action="index.php" method="post" name="frm" onSubmit="return validate();"> 
                        <table border="0" cellpadding="0" cellspacing="0" width="60%">
                        <tr>
                          <td>
	                        <input name="mode" value="verify" type="hidden">
	                        <table border="0" cellpadding="5" cellspacing="0" width="100%">
                            
                             <tr class="ct">
                              <td colspan="3" width="110">Login</td>
                              </tr>
                              <tr>
                              <td width="110">Username:</td>
                              <td>
                                <input name="txtName"  class="bluetext" type="text">
                              </td>
                            </tr>
                            <tr>
                              <td >Password:</td>
                              <td><input type="hidden" name="cansave" value="0">
                              <input name="txtPswd" class="bluetext" type="password"></td>
                            </tr>
                            <tr>
                              <td class="rt size18 darkgray">&nbsp;</td>
                              <td class="lt"><input name="submit3" value="Sign In" class="button" type="submit"></td>
                            </tr>
                          </table></form>

<script language="JavaScript">
function validate()
{
if(document.frm.txtName.value=="")
	{
	alert("Please enter the username");
	document.frm.txtName.focus();
	return false;
	}
if(document.frm.txtPswd.value=="")
	{
	alert("Please enter the password");
	document.frm.txtPswd.focus();
	return false;
	}
document.frm.cansave.value=1;
return true;
}
</script>