Jump to content

Recommended Posts

Posted

I am setting up a directory with WEB PROTECT. I want to build the page based on their userid entered. How can I grab the userid they enter?

 

I have one Admin page, 6 different categories, based on their userid (usercat1, usercat2 ...) I want to filter the data they can access (cat1, cat2 ...)

 

Thanks in advance.

 

DPK

Posted

I found the following to get the id:

$_SERVER['PHP_AUTH_USER'].

 

Issue now is logging out.

 

I've tried

 

session_start();

session_unset();

session_destroy();

 

but I found out PHP sessions won't have anything to do with .htaccess logins.

 

So, any thoughts here?

Posted

Hello,

 

Hmm the internet seems full of different ideas with everybody claiming that everyone elses doesnt work.

 

Anyway, try this, save it as logout.php and call it by pressing the button:

 

><?php
session_start();

// if the user is logged in, unset the session
if (isset($_SESSION['PHP_AUTH_USER'])) {
  unset($_SESSION['PHP_AUTH_USER']);
}
if (isset($_SESSION['PHP_AUTH_PW'])) {
  unset($_SESSION['PHP_AUTH_PW']);
}
// now that the user is logged out,
// go to login page or whatever
header('Location: login.php');
?>

 

Jimuni

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...