I have the following code for a user authentication script, however, when the correct username and password match, the page is included (newpage.php)comes up.....BUT...... newpage.php does not know that the username and password have been validated until the page is refreshed.
This is tiresome! You can see it working (or not!) at http://www.rupstar.com/newindex.php
<?php
if (!$username || !$pwd) { print "ERROR - Missing user name or password."; exit; }
else {
include("mysql.inc");
$result = mysql_query( "SELECT * FROM loginTable WHERE email='$username' && password='$pwd'");
$num_rows = mysql_num_rows( $result );
if ($num_rows != "1") { print "ERROR - Your username and password do not match."; exit; }
else {
setcookie( "Email", $username, "0" );
mysql_close( $link );
include("newpage.php"); }
}
?>