password-script-met-meerdere-users
Gesponsorde koppelingen
PHP script bestanden
Code (php)
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
error_reporting(E_ALL);
$auth = false;
$user = array("username1","username2","username3");
$pass = array("password1","password2","username3");
$num = count($user);
if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
for($i=0; $i<$num; $i++) {
if($_SERVER['PHP_AUTH_USER'] == $user[$i] && $_SERVER['PHP_AUTH_PW'] == $pass[$i])
$auth = true;
}
}
if(!$auth) {
header('WWW-Authenticate: Basic realm="Cassy-web CLUB"');
header('HTTP/1.0 401 Unauthorized');
echo '<center><h1>Authentication failed</h1>Username and Password required<br><br>Private Section !!!</center>';
exit;
}
echo 'Dit is de geheime pagina'; //je kan er ook een frame in zetten
?>
error_reporting(E_ALL);
$auth = false;
$user = array("username1","username2","username3");
$pass = array("password1","password2","username3");
$num = count($user);
if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
for($i=0; $i<$num; $i++) {
if($_SERVER['PHP_AUTH_USER'] == $user[$i] && $_SERVER['PHP_AUTH_PW'] == $pass[$i])
$auth = true;
}
}
if(!$auth) {
header('WWW-Authenticate: Basic realm="Cassy-web CLUB"');
header('HTTP/1.0 401 Unauthorized');
echo '<center><h1>Authentication failed</h1>Username and Password required<br><br>Private Section !!!</center>';
exit;
}
echo 'Dit is de geheime pagina'; //je kan er ook een frame in zetten
?>