Solved

Get the user who is logged in!

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …

757 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

18 Experts available now in Live!

Get 1:1 Help Now