stay logged in for session
| From: | Joshua | Date: | Fri, 18 May 2007 10:43:26 +0000 |
| Subject: | stay logged in for session | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-255119@lists.php.net to get a copy of this message | ||
hey guys, i am trying to set up a session so that when a user logs in,
they will stay logged in until they close their browser. i have the
session set up, however i keep getting an error saying:
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this
address in a way that will never complete.
----------------------------------------------------------------------
this is my code, any help plz.
----------------------------------------------------------------------
checklogin.php:
<?php
session_start();
//set session variables
$_SESSION['txtSurname'] = $_REQUEST['txtSurname'];
$_SESSION['txtPassword'] = $_REQUEST['txtPassword'];
session_write_close();
include('includes/dbconnect.php');
$nextpage = $_REQUEST['np'];
$profile = $_REQUEST['ob'];
//Matching usernames and passwords
$uname = $_REQUEST['txtSurname'];
$pword = $_REQUEST['txtPassword'];
$user = "SELECT * FROM oldboys WHERE OBSURNAME='" . $uname . "' AND
PWORD='" . $pword . "'";
$ResSql = mysql_query($user) ;
//If any errors then print `em out----------------------------
if (!$ResSql) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
//if user does not exist
if (mysql_num_rows($ResSql)==0) {
echo 'Incorrect username or password have been specified.<br>';
echo '<a href="updlogin.php">Click here to Log In</a>';
exit;
}
else {
header("Location:" . $nextpage . "?ob=" . $_REQUEST['ob'] .
"&uname=" . $_REQUEST['txtSurname'] . "&pword=" .
$_REQUEST['txtPassword']);
}
?>
verify.php:
<?php
session_start();
if(!isset($_SESSION['txtSurname']) && !isset($_SESSION['txtPassword']))
{
header("location:updlogin.php?np=" . $_REQUEST['np'] . "&ob=" .
$_REQUEST['ob']);
}
else {
header("location:" . $nextpage . "?np=" . $_REQUEST['np'] .
"&ob=" .
$_REQUEST['ob']);
}
?>
-----------------------------------------------------------------------