<?


  unset ($granted);
  if (!($result = mysql_query ('select * from users')))
  {
    exit ('Invalid query');
    ;
  }

  while ($row = mysql_fetch_array ($result))
  {
    if ($_COOKIE['autorized'] == md5 (md5 ($row['username'] . $row['password'])))
    {
      $granted = true;
      continue;
    }
  }

  if (!$granted)
  {
    echo 'access denied!';
    exit ();
  }

?>
