Solved

Get the user who is logged in!

Posted on 2003-11-20
2
294 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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 …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

919 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now