File: basic.php

package info (click to toggle)
siege 4.1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,676 kB
  • sloc: ansic: 13,015; sh: 9,149; makefile: 160; php: 142; perl: 11
file content (26 lines) | stat: -rw-r--r-- 771 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
$realm = "siege_basic_auth";
$user  = "siege";
$pass  = "haha";

if($_SERVER['PHP_AUTH_USER'] == $user && $_SERVER['PHP_AUTH_PW'] == $pass){
?>
<HTML>
  <head><title>SIEGE: Successful login</title></head>
  <body>
    <h2>Logged in as "siege"</h2>
    Congratulations. You are able to penetrate our defenses by entering the <br>username and password combination that we provided you on the login page.
  </body>
</HTML>
<?php
} else {
  Header("WWW-Authenticate: Basic realm=\"$realm\"");
  Header('Status: 401 Unauthorized');
  echo "<h2>Authorization required!</h2>";
  echo "You can log into this page with the following credentials:<br>";
  echo "<code>Username: $user<br>";
  echo "Password: $pass<br>";
  echo "Realm (optional): $realm</code>";
  exit;
}
?>