Login.php
// db connection string
$conn=mysql_pconnect($dbhost,$dbuser,$dbpass);
if(!@$conn) {
echo "
Unable to Establish Connection to the Server
";
exit();
}
$db_sel=mysql_select_db($dbname,$conn);
if(!@$db_sel) {
echo "Unable to Connect to the Database
";
exit();
}
// Submit button click
$uname = $_POST['uname'];
$pass = $_POST['pass'];
if(isset($_REQUEST['submit']))
{
$sign=mysql_query("select * from ".ADMINLOGIN." where username='$uname' and password='$pass'");
$no=mysql_num_rows($sign);
//if username and password matches
if($no==1)
{
$_SESSION['logkey']=signedup;
$_SESSION['adminname']=$uname;
$logintimes=mktime();
$ipaddress=$_SERVER['REMOTE_ADDR'];
// redirect to the password protected page
echo "";
exit();
}
Else{ // if username password entered is wrong
Echo “invalid password”;
}
?>