session_start();
header("Cache-control: private");//IE 6 fix
$link = sqlite_open("adhakal.db", 0666, $errmsg);
if ( isset($_POST["login"]))
{
$password = md5($_POST[passwd]);
$result = sqlite_query("select * from user_authorization where user_id='$_POST[username]' and password_encrypted='$password'", $link);
if ( sqlite_num_rows($result) )
{
$result = sqlite_fetch_array($result);
$activated = $result['activated'];
if ( $activated == 0 )
{
echo "
We found your registration information but you need to activate your account first.
";
echo "Please check your email and follow instructions for activation.
The email was sent when you registered with us.
";
echo "Thank you.
";
echo " Click here to go back to the login page";
exit;
}
$_SESSION['loggedIn'] = $_POST['username'];
header ("location:welcome.php");
}
else
{
$loginerr1 = "Invalid username or password.";
$loginerr2 = "Please make sure that CAPS LOCK isn't on";
}
}
else
{
session_destroy();
}
?>