$_SESSION problem

Status
Not open for further replies.

freetool

New Member
Messages
3
Reaction score
0
Points
1
Hi, i'm working on my test site, and i have set login system. However it doesn't work because system unset $_SESSION automatically after you have finished that action. Is there any setup which is doing it automatically which i should edit and after that it should works?

Thanks, for you answers :)
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Hi freetool, PHP's sessions should function fine. The behavior you're describing sounds like the session cookie is not being saved by a web browser. (This is set by PHP when session_start begins a session.) Usually the cause of this is due to session_start() being called sometime after output has been sent from the PHP script. Any output at all, even a blank space, can cause this trouble. Try the following in a test.php script to confirm sessions are working:
PHP:
<?php
session_start();
if (!isset($_SESSION['t'])) $_SESSION['t'] = 0;
$_SESSION['t'] += 1;
print $_SESSION['t'];

With each reload that should output an increasing number.
 
Status
Not open for further replies.
Top