You are here: Re: Simplest scheme for password protection? « PHP Programming Language « IT news, forums, messages
Re: Simplest scheme for password protection?

Posted by Rik on 10/24/06 02:52

laredotornado@zipmail.com wrote:
> Thanks, Rik. This is the solution I'll pursue. But I have one follow
> up question. What does "accesscontrol.php" return upon successful
> authentication and upon authentication failure?
>


$logged_in = your_own_code();
if(!$not_logged_in){
header('HTTP/1.0 401 Unauthorized');
exit;
}
$path = parse_url($_GET['file'],PHP_URL_PATH);
$file = dirname(__FILE__).'/'.$fake_url['path'];
if(!is_file($file){
header("HTTP/1.0 404 Not Found");
exit;
}
$ext = pathinfo($file,PATHINFO_EXTENSION);
if(strcasecmp($ext,'php') || strcasecmp($ext,'html'){
include($file);
exit;
}
$ext_mime = array(
'jpg' => 'image/jpeg',
'pdf' => 'application/pdf',
etc...);
header('Content-type: '.$ext_mime[$ext]);
readfile($file);

--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация