| | |
session not keeping user logged in
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2008
Posts: 5
Reputation:
Solved Threads: 0
I have a web page which I can login to with a user name and password and when the page reloads of the first time after the signin the session loads and has my status correct but just navigating to another page (all done through the same php file with includes later in the file) the session fails and I am back to an anonymous (unlogged in) visitor.
Here is the logic (note $sesTime is set to 1 min for testing)
Anyone explain where I am fuddling this up?
Here is the logic (note $sesTime is set to 1 min for testing)
PHP Syntax (Toggle Plain Text)
<?php $ses="MYSID"; $sesTime=60*1; session_set_cookie_params ($sesTime); session_name($ses); session_start(); if($_POST[mode]=="LogOut"){ $_SESSION=array(); session_destroy(); session_set_cookie_params ($sesTime); session_name($ses); session_start(); } if(isset($_COOKIE[$ses])){if(setcookie($ses,$_COOKIE[$ses], time()+$sesTime, "/")){echo "reset cookie";}}
Anyone explain where I am fuddling this up?
Last edited by ZaphodQB; Apr 25th, 2008 at 12:13 am.
•
•
Join Date: Apr 2008
Posts: 5
Reputation:
Solved Threads: 0
•
•
•
•
I have a web page which I can login to with a user name and password and when the page reloads of the first time after the signin the session loads and has my status correct but just navigating to another page (all done through the same php file with includes later in the file) the session fails and I am back to an anonymous (unlogged in) visitor.
Here is the logic (note $sesTime is set to 1 min for testing)
PHP Syntax (Toggle Plain Text)
<?php $ses="MYSID"; $sesTime=60*1; session_set_cookie_params ($sesTime); session_name($ses); session_start(); if($_POST[mode]=="LogOut"){ $_SESSION=array(); session_destroy(); session_set_cookie_params ($sesTime); session_name($ses); session_start(); } if(isset($_COOKIE[$ses])){if(setcookie($ses,$_COOKIE[$ses], time()+$sesTime, "/")){echo "reset cookie";}}
Anyone explain where I am fuddling this up?
$sesTime=time()+60*1;
in line 3
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: how to pass one script to another using php,mysqldatabase
- Next Thread: uploading iamges to server
| Thread Tools | Search this Thread |
apache api array basic beginner binary broken cache cakephp checkbox class cms code computing confirm cron curl customizableitems database date delete display dynamic echo email error external file files filter folder form forms forum function functions gc_maxlifetime google headmethod host howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction memmory memory menu mlm multiple mysql navigation oop parsing paypal pdf php phpmysql problem query question radio random recursion remote script search select server sessions sms snippet source space sql syntax system table thesishelp trouble tutorial update upload url validator variable video web youtube





