note 53216 deleted from features.http-auth by cmb

From: Date: Sun, 13 Oct 2019 08:18:20 +0000
Subject: note 53216 deleted from features.http-auth by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212640@lists.php.net to get a copy of this message
Note Submitter: aplanefan at mail dot com ---- I found a way to log out easily <?php ob_start(); if (!isset($_SERVER['PHP_AUTH_USER']) || $_COOKIE['isin'] != "1") { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); setcookie ("isin", "1"); die('<a href="orderhan.php">Login</a>'); } else { if($_SERVER['PHP_AUTH_USER'] == "USER" && $_SERVER['PHP_AUTH_PW']== "PASSWORD") { echo "you got in"; echo "<a href='".$_SEVER['PHP_SELF']."?action=logout'>logout</a>"; } else { setcookie ("isin", "", time() - 3600); $url=$_SERVER['PHP_SELF']; header("location: $url"); } if($_GET['action'] == "logout") { setcookie ("isin", "", time() - 3600); $url=$_SERVER['PHP_SELF']; header("location: $url"); } } ob_end_flush(); ?>

« previous php.notes (#212640) next »