•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 375,221 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,179 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 208 | Replies: 2
![]() |
•
•
Join Date: Apr 2008
Posts: 5
Reputation:
Rep Power: 0
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 24th, 2008 at 11:13 pm.
•
•
Join Date: Apr 2008
Posts: 5
Reputation:
Rep Power: 0
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?
Never mind I figured out what was wrong, it should have been;
$sesTime=time()+60*1;
in line 3
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: how to pass one script to another using php,mysqldatabase
- Next Thread: find county using ip address


Linear Mode