Jump to content

Sessions In AJAX


sid_o

Recommended Posts

Hi,

I am redesigning an application from standard PHP to AJAX style & encounter an issue i can't get around it. i will appreciate any ideas & help.

 

The application is closed to registered users only, & i have a setting for session to be live for 1 hour, when it was standard PHP there was no problem, every page load checked the session & acted accordinly, however in ajax i want to have a function the checks if the session timeout & even if no action has been made from the user the page will automaticly redirect itseld to the login page. But i cant seem to get it, will the call to an AJAX function & from there to a PHP file, will that update the session & therefor prevent it from ever expiring?

 

Cheers

S.

Link to comment
https://forums.phpfreaks.com/topic/171522-sessions-in-ajax/
Share on other sites

will that update the session & therefor prevent it from ever expiring?

Yes, if the page has a session_start() statement. The HTTP request for a page that AJAX makes to the web server is exactly the same as any other HTTP request for a page to the web server. The only thing that AJAX adds is that the response back from the web server is processed by javascript within the current page in the browser.

Link to comment
https://forums.phpfreaks.com/topic/171522-sessions-in-ajax/#findComment-904481
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.