Search for:

PHP Login and Logout Script

This is very simple Login and Logout Script. It is a simple script so that you can understand the logic and modify the script easily. No script can fulfill all your requirements in working condition so it is a small and simple script for you to modify.

It has referrer functionality send users to landing page after login. A special target functionality also works when suppose in case user is admin.

Can you see $_SESSION['SpecialTarget'] in login page! You can use that to redirect to a desired page from where a user is coming. Like you have a privileged page 'admin.php'; Here you will check if user is logged in or not. If not logged in, then redirect him to login page. After login he will automatically be redirect to this page.