AlfieWebDevTips Homefor new and experienced developers
[Home Home] [Web Development Web Development ] [Code Generators Code Generators ] [Resources Resources ] [Contact Us Contact ] |WebDevTips Privacy Privacy |
Print This Page

You are here : Home - Web Development - PHP - Password Protect - Logout

Password Protect - Logout



copy and save as logout.php

<? 
//clear the cookie and return to login 
$login_page = "index.php"; 
setcookie ("this_cookie", "", 0, "", "", 0); 
setcookie ("name", "", 0, "", "", 0); 
header("Location: $login_page"); 
exit(); 
?>

The setcookie code above kills the cookie in all browsers including Opera.

Here is a demo made up with the code you now have. Login with username : demo password :demo

And as I am such a nice guy I have also zipped up all the files for you to download. Download all the files needed here (4k).

I hope you find this script useful. If you have any problems or have any suggestion then please use the webdevtips forums. Thanks


overview
the theory
the login
validation
a protected page
the logout
If you like our script, please rate it!







Google
 

[back to top of page]   

[labelled with icra -  - this link will open in a new window] [RSS Content]

[Copyright © WebDevTips]