try this. (ignore the session stuff if you don't want to use it)
session_start();
$error="";
if ($_POST['submit']) {
$pass = $_POST['pass'];
$user = $_POST['user'];
$db = @mysql_connect("localhost","db_user","db_password") or header("Location: db_error.php");
mysql_select_db("dbase_name",$db) or header("Location: db_error.php");
$result = mysql_query("SELECT * FROM table WHERE user= \"$user\" AND pass= \"$pass\"",$db);
$num = @mysql_num_rows($result);
if ($num != 0) { $_SESSION[login] = "1"; header("Location: redirect.php]");
}else{
$error="Details not found, try again.";
}
}
Set your form tag to :
<FORM NAME="security" ACTION="<? PHP_SELF ?>" METHOD=POST>
and have two text fields called user and pass
Probably not the neatest code you'll ever see but it works.