Jump to content

HTTP Authentication problem?


shakeelstha

Recommended Posts

<?php

ob_start();

session_start();

 

$auth_user="manager";

$auth_pwd="manager";

 

if($_SERVER['PHP_AUTH_USER']==$auth_user && $_SERVER['PHP_AUTH_PW']==$auth_pwd && $_SESSION['authorized']==1)

{

include_once("session.php");

open_session_admin($auth_user);

  header("Location: resadmin.php");

//echo "you are logged in......</ br>";

}

else

{

$_SESSION['authorized']=1;

    authenticate();

}

 

function authenticate()

{

    header('WWW-Authenticate: Basic realm="Enter Your Login detail to access the page"');

    header('HTTP/1.0 401 Unauthorized');

    echo "You must enter a valid login ID and password to access this resource\n";

    exit;

}

?>

 

 

 

This code runs well in localhost in windows platform. But after uploading it to linux server, it doesn't work. What is the problem?

Link to comment
https://forums.phpfreaks.com/topic/96359-http-authentication-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.