<?php 
			session_start();
$user="cp037684_tbadm";
$password="siamnovaTho1220!";
$database="cp037684_tbadm";

mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");

echo $query="SELECT * FROM user   WHERE  userid='$id'   "; //
$result=mysql_query($query);

$num=mysql_numrows($result);

$i=0;
$userid=mysql_result($result,$i,"userid");
$passw=mysql_result($result,$i,"passw");
$position=mysql_result($result,$i,"position");

if(($userid==$id)&&($passw==$pw)) 
   {

			session_register("uid");
			session_register("status");
			$uid=$id;
			$status="on";
            
			$query = "INSERT INTO log SET userid='$uid',action='0' ";
			mysql_query($query);		

            mysql_close();
		header("Location:./form2.php");
		//echo " Ok :  <a href=form2.php>Gold Price</a>";

	}else 
	{
	   echo "Try Again  | <a href=login.php>Back</a>"; 
       mysql_close();
	}

?>