com web/master: Making logouts easier for the first time in a dozen years.: include/functions.inc login.php
| From: | Daniel P. Brown | Date: | Fri, 18 Jan 2013 19:57:30 +0000 |
| Subject: | com web/master: Making logouts easier for the first time in a dozen years.: include/functions.inc login.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-15344@lists.php.net to get a copy of this message | ||
Commit: 24cdb723f439eda5db0f76f1aa9c638cccd56d03
Author: Daniel P. Brown <danbrown@php.net> Fri, 18 Jan 2013 14:57:30 -0500
Parents: 07da9a04b2e17c72f15e74fe984b601a4707b812
Branches: master
Link: http://git.php.net/?p=web/master.git;a=commitdiff;h=24cdb723f439eda5db0f76f1aa9c638cccd56d03
Log:
Making logouts easier for the first time in a dozen years.
Changed paths:
M include/functions.inc
M login.php
Diff:
diff --git a/include/functions.inc b/include/functions.inc
index 7885478..6852cf8 100644
--- a/include/functions..inc
+++ b/include/functions.inc
@@ -63,6 +63,7 @@ function head($title="",$private=1) { // Default to $private == true to
permit n
<?php if (isset($_SESSION['user'])) { ?>
<li><a href="/manage/users.php?username=<?php echo
$_SESSION['user']; ?>">My php.net Profile</a></li>
<?php } ?>
+ <li><a href="/login.php?action=logout">Logout</a></li>
</ul>
<?php
warn("Have you changed your password yet?");
diff --git a/login.php b/login.php
index 77605b4..a7f8a97 100644
--- a/login.php
+++ b/login.php
@@ -1,6 +1,14 @@
<?php
// $Id$
+if (isset($_GET['action']) && $_GET['action'] == 'logout') {
+ session_start();
+ session_destroy();
+ echo 'You have successfully logged out. Redirecting....'.PHP_EOL;
+ echo '<meta http-equiv="refresh" content="5;http://php.net/"/>'.PHP_EOL;
+ exit(0);
+}
+
require 'login.inc';
head();