Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get the user who is logged in!

Posted on 2003-11-20
2
Medium Priority
?
309 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 680 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
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.
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

782 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