Reputation: 11363
I have a few pages on my site that are protected from invalid access via checking several $_SESSION
variables that are set during the login process. If an access request fails, then the page redirects to the standard login form.
I've refactored my site to incorporate jQuery dialog boxes to handle the login and registration process and as only the index page is public-facing, these boxes are controlled by the default navigation bar. All other pages are protected via checking $_SESSION
variables on page load.
How can I incorporate the header redirect to the index page and open a warning dialog box that access is not allowed to that specific page?
Upvotes: 0
Views: 508
Reputation: 1184
You could pass a query string in the url and echo out the appropriate jQuery.
You could also get the query string value in JavaScript.
How can I get query string values in JavaScript?
Upvotes: 1
Reputation: 574
Probably try to redirect to something like:
/login.php?openlogin=1
Then in your PHP code embed opening of the dialog into something like:
<?php if (@$_GET['openlogin']) { ?>
<script>
// open dialog here, e.g. $(foo).dialog('open')
</script>
<?php } ?>
Upvotes: 1