<?
if (!$submit) {
?>
<form method=post action="login.php">
Username:<input type="text" name="username"><br>
Password:<input type="password" name="password"><br>
<input type="submit" name="submit" value="Submit">
</form>
<?
}
if ($submit) {
include ('config.php');
$connection = mysql_connect ("$host", "$user", "$pass") or die ( "Couldn't connect to server.");
$db = mysql_select_db ("$dbase", $connection) or die ( "Couldn't select database.");
$sql = "select * from details where username=\"$username\" and password=\"$password\"";
$result = mysql_query($sql) or die ("Couldn't execute query.");
$check_num = mysql_num_rows($result);
if ($check_num == 0) {
echo "Either you are not signed up or you entered an incorrect password. Hit Back to try again.";
exit;
}
else {
echo "Access Granted<br><a href=file.php>Continue</a>";
}
}
?>