Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quick osCommerce administration authentication f


smart

Recommended Posts

Hi I have uploaded Quick osCommerce administration authentication f files.

 

When I enter user and password does not let me in?

 

I will post code below............

 

<?

class BasicAuthenticator

{

var $realm = "<private>";

var $message;

var $authenticated = -1;

var $users;

 

function BasicAuthenticator($realm, $message = "Access Denied")

{

$this->realm = $realm;

$this->message = $message;

}

 

 

function authenticate()

{

if ($this->isAuthenticated() == 0)

{

Header("HTTP/1.0 401 Unauthorized");

Header("WWW-Authenticate: Basic realm=\"$this->realm\"");

echo $this->message;

exit();

}

else

{

Header("HTTP/1.0 200 OK");

}

}

 

 

function addUser($user, $passwd)

{

$this->users[$user] = $passwd;

}

 

 

function isAuthenticated()

{

global $PHP_AUTH_USER;

global $PHP_AUTH_PW;

 

if ($this->authenticated < 0)

{

if(isset($PHP_AUTH_USER))

{

$this->authenticated = $this->validate($PHP_AUTH_USER, $PHP_AUTH_PW);

}

else

{

$this->authenticated = 0;

}

}

 

return $this->authenticated;

}

 

 

function validate($user, $passwd)

{

if (strlen(trim($user)) > 0 && strlen(trim($passwd)) > 0)

{

// Both $user and $password are non-zero length

if (isset($this->users[$user]) && $this->users[$user] == $passwd)

{

return 1;

}

}

return 0;

}

}

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...