Re: Re: PHP sessions, AJAX, authentication and security.
| From: | Angus Mann | Date: | Sat, 21 Nov 2009 22:15:04 +0000 |
| Subject: | Re: Re: PHP sessions, AJAX, authentication and security. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-300021@lists.php.net to get a copy of this message | ||
same as everywhere else in your apps.. ajax is no different in any way at all, not even slightly. as far as PHP and web server is concerned it's just a plain old request same as any other; thus.. if( !$_SESSION['is_logged_in'] ) { exit(); } // do stuffThanks for that. Sometimes the solution is right there in front of you. The bit of code below does the job nicely for me : session_start(); if(!isset($_SESSION['username'])){ echo("Go Away."); exit(); } // now work with sensitive data...