hi all:
i am trying to use this code to login to members area but everytime i try to login with a registered user it redirects to the registration page please help.
below is the code:
<?php
session_start();
$uname="root";
$pword="";
$host="localhost";
$database="spl";
$Username=$_POST['Username'];
$Password = MD5($_POST['Password']);
$_SESSION['Username']=$Username;
mysql_connect("$host", "$uname", "$pword")or die("cannot connect");
mysql_select_db("$database")or die("cannot select DB");
$checkUsername=mysql_query("select Username, Password from registration where Username='Username' and Password='Password'");
$Username_exist=mysql_num_rows ('$checkUsername');
if ($Username_exist>0)
{
header("location:indexma.php");
}
else
{
echo "not registered";
header("location:register.php");
}
?>
and also how do i destroy a session please help ASAP. thank you