Solved

Get the user who is logged in!

Posted on 2003-11-20
2
297 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
[X]
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
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 dynamically set the form action using jQuery.

749 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