3 if (isset($_SESSION['triedTimes']))
4 $_SESSION['triedTimes'] = $_SESSION['triedTimes'] + 1;
6 $_SESSION['triedTimes'] = 1;
8 $username = $password = "aaaa";
10 if ($_SERVER['PHP_AUTH_USER'] == $username && $_SERVER['PHP_AUTH_PW'] == $password){
11 echo "Auth dialog behavior when press OK button: ";
12 if ($_SESSION['triedTimes'] == 5)
13 echo "<span style='color:green'>PASS</span>";
15 echo "<span style='color:red'>FAIL</span>";
18 header('WWW-Authenticate: Basic realm="My Realm"');
19 header('HTTP/1.0 401 Unauthorized');
20 echo "Auth dialog behavior when press Cancel button: ";
21 if ($_SESSION['triedTimes'] == 1)
22 echo "<span style='color:green'>PASS</span>";
24 echo "<span style='color:red'>FAIL</span>";