Jump to content

[SOLVED] session


spooke2k

Recommended Posts

what am i doing wrong

 

php on the first login php page

 

if (mysql_num_rows($userselect) > 0) {

$row=mysql_num_rows($userselect);

echo "You are logged in as $userselect <br>";

$URL="http://127.0.0.1/tut.php";

 

session_start();

header("Cache-control: private");

$_SESSION['userid'] = $username;

header ("Location: $URL");

} else {

echo("Login Incorrect. Please Try Again!");

}

 

i want to do a check if the user has a session ie logged in this is the check on the second php page

 

if (isset($_SESSION['userid'])) {

    }else{

echo "You aren't logged in.";

$URL = "http://127.0.0.1/login.htm";

header ("Location: $URL");

    exit();

}

 

Please help many thanks

 

Spooke2k

 

 

Link to comment
https://forums.phpfreaks.com/topic/54727-solved-session/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.