Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Session not working

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm trying to do a simple session in PHP (running Apache and PHP4Win build under Windows 2000). I cannot get my session to work. Is there anything special that is needed under Apache or PHP config to get sessions working. I have session support enabled in PHP and confirmed it with phpinfo().

Here's what I'm trying:

File 1:
<?
session_start();
$auth=true;
session_register('auth');
?>
<p>Click <a href=&quot;<link to file 2>&quot;>here</a> to proceed.

File 2:

if (session_is_registered('auth')) {
echo &quot;<p>You have been authenticated. You can view this page.&quot;;
} else {

echo &quot;<p>You have not logged in. Auth=$auth Click <a href=login.html>here</a> to do so.&quot;;
}

Thanks for any help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top