<?php
$users = array('admin' => 'adminpass', 'guest' => 'passas')'
function exist($users, $name, $pass)
{
foreach ($users as $username=>$password)
if ($username === $name && $password === $pass)
return TRUE;
return FALSE;
}
if (!isset($_SERVER['PHP_AUTH_USER']) || !exist($users, $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']))
{
authenticate();
}
else
{
echo sprintf ("Suvesta - %s:%s", $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
}
?>