I'm developing this small system in AJAX (my first one using either PHP or Javascript). All redirections in my system are just refreshments of small containers within the same page. What I want to do is run a small authentication script on each js "redirection" (that uses the session vars to verify authentication). What I do then, is associate events (like the onclick on a link or button) to my js redirection script which substitutes the content of a div with the output of a php file (so my pages are php files that are just a piece of what is shown on the actual page). Right now, my pages look like this:
Code: Select all
try {
require_once "authenticate.php";
// Output code here.
} catch (Exception $e){
echo "Authentication failed";
}Thanks in advance!