Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP $_SESSIONS and ajax without reloading page?
Old 04-20-2008, 01:21 PM PHP $_SESSIONS and ajax without reloading page?
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Hi

Ive run into a problem with a login logout script which im trying to wrtie with ajax post requests. It all works as it should, except the my $_SESSION[activeuserid] variable (which is set and unset by my login() and logout() functions) is not getting set until i refresh the page.

For example, i call login.php through an AJAX request (login())which sets $_SESSION[activeuserid]. Then, once my login() function has finished executing, checkLogin() runs to establish whether or not the user is logged in, displaying the appropriate information. Although Login() has just changed the $_SESSION[activeuserid] variable, checkLogin() doesnt seem to read it until i reload the page.

Can anybody tell me is this is standard behaviour?
hiptobesquare is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-20-2008, 03:16 PM Re: PHP $_SESSIONS and ajax without reloading page?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Seesions are ONLY written on a page load/refresh
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-23-2008, 05:22 AM Re: PHP $_SESSIONS and ajax without reloading page?
Super Spam Talker

Latest Blog Post:
PSD Squirrel Launched
Posts: 933
Trades: 7
what file holds the checkLogin() function? is it login.php?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Sir P is offline
Reply With Quote
View Public Profile Visit Sir P's homepage!
 
Old 04-24-2008, 02:03 AM Re: PHP $_SESSIONS and ajax without reloading page?
phpknowhow's Avatar
Skilled Talker

Posts: 83
Name: Colin
Location: USA
Trades: 0
My advice would be to create a supplemental cookie with Javascript onLoad. Check for either the cookie or the session.
__________________

Please login or register to view this content. Registration is FREE
| Freelance PHP solutions for small to midsized projects |
Please login or register to view this content. Registration is FREE
phpknowhow is offline
Reply With Quote
View Public Profile Visit phpknowhow's homepage!
 
Reply     « Reply to PHP $_SESSIONS and ajax without reloading page?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23433 seconds with 12 queries