Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Get the user who is logged in!

Posted on 2003-11-20
2
296 Views
Last Modified: 2012-06-27
when using the .htaccess/.htpasswd log-in system how do i get the user who is logged in to display user specific content? Thanks in advance for the help.

gf3
gf3@bm3.org
0
Comment
Question by:gf3
2 Comments
 
LVL 4

Accepted Solution

by:
bljak earned 170 total points
ID: 9796947
$_SERVER["PHP_AUTH_USER"]
$_SERVER["PHP_AUTH_PW"]
$_SERVER["PHP_AUTH_TYPE"]

http://www.php.net/manual/en/features.http-auth.php

lets say you made files called after username, for example after me, and file is bljak.inc.php

<?php
if(!isset($_SERVER["PHP_AUTH_USER"]))
{
  $file = "access_denied.php";
} else {
  $file = $_SERVER["PHP_AUTH_USER"].".inc.php";
}
include($file);
?>

//bljak
0
 
LVL 1

Author Comment

by:gf3
ID: 9799959
Ok thanks
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question