ScotlandPHP 2019


Please answer this simple SPAM challenge: min(five, one)?
(Example: nine)

The Note You're Voting On

12 years ago
I used Louis example (03-Jun-2006) and it works well for me (thanks).

However, I added some lines, to make sure, the user does only get the Authentification-Window a few times:

= mt_rand( 1, 1000000000)."@YourCompany";
$_SESSION['realm'] = $realm;

// In the beginning, when the realm ist defined:
$_SESSION['CountTrials'] = 1;

And then when it comes to check the authentification (ZEND-Tutorial):


// Not more than 3 Trials
if (!$auth) {
   if (
$_SESSION['CountTrials'] == 4) {  
session_destroy() ;
header('Location: noentry.php');
       exit ;  
   } else {
header("WWW-Authenticate: Basic realm=".$_SESSION['realm']);
header("HTTP/1.0 401 Unauthorized");
'Authorization Required.';
} else {
'<P>You are authorized!</P>';

noentry.php is slightely different from comeagain.php.

<< Back to user notes page

To Top