Validating Users

From: Date: Sat, 03 May 2003 00:56:20 +0000
Subject: Validating Users
Groups: php.general 
Request: Send a blank email to php-general+get-146215@lists.php.net to get a copy of this message
I have written this page: <?php include("inc/php/login.php.inc"); if (login($_POST['username'], $_POST['password'])) { if ($_POST['rem'] == "true") { setcookie ('site_user', $_POST['username'], time()+31536000, '/', 'localhost', '0'); setcookie ('site_pass', $_POST['password'], time()+31536000, '/', 'localhost', '0'); echo "<meta http-equiv=\"refresh\" content=\"0;URL=http://localhost/web/uni/home.php\">"; } else { echo "<meta http-equiv=\"refresh\" content=\"0;URL=http://localhost/web/uni/home.php\">"; } } elseif (login($_COOKIE['site_user'], $_COOKIE['site_pass'])) { echo "<meta http-equiv=\"refresh\" content=\"0;URL=http://localhost/web/uni/home.php\">"; } else { include("inc/html/head.inc"); echo "<div id=\"content\">"; echo "<span class=\"error\">There has been a problem with your login please try again.</span>"; echo "<form name=\"login\" method=\"post\" action=\"valid_user.php\"> Username:<input type=\"text\" name=\"username\" class=\"form\"><br /> Password:<input type=\"password\" name=\"password\" class=\"form\"><br /> <input type=\"submit\" name=\"Submit\" value=\"Login\" class=\"form\"> Remember Me<input type=\"checkbox\" name=\"rem\" value=\"true\"> </form>"; echo "</div></body></html>"; } ?> I know that the login function works so I would like to know why it only returns the final error message rather than confirming access? Cheers James

« previous php.general (#146215) next »