You can use this programming part in here. If you have any question, you can 
send mail

<?php
if ( ( !isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW)) || ( 
verify($PHP_AUTH_USER,$PHP_AUTH_PW) == false) )
{
header( 'WWW-Authenticate: Basic realm="Header of the password box"' );
header( 'HTTP/1.0 401 Unauthorized' );
echo "<h1>Authorization Required.</h1>";
exit;
}
else
{
session_start();
session_register("user");
$_SESSION["user"]= $PHP_AUTH_USER;
header( 'Location: http://www.doain.com');
}


function verify($username, $password)
{
$usercount = 1;
$myusername = array (0=>"username");
$mypassword = array (0=>"password");
$auth = false;

for ($i = 0; $i < $usercount; $i ++)
if ( ($myusername[$i] == $username) && ($mypassword[$i] == $password) )
$auth = true;
return $auth;
}

?>

Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara
Web: http://www.haydartuna.net

"Chris W" <[EMAIL PROTECTED]>, haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]

>I want to read a page that is protected with http authentication.  How do I 
>pass the user name and password to be authenticated with my php code?
>
> -- 
> Chris W
> KE5GIX
>
> "Protect your digital freedom and privacy, eliminate DRM, learn more at 
> http://www.defectivebydesign.org/what_is_drm";
>
> Gift Giving Made Easy
> Get the gifts you want & give the gifts they want
> One stop wish list for any gift, from anywhere, for any occasion!
> http://thewishzone.com 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to