getting username...

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

seplomaniac
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Jul 19, 2003 4:00 pm
Location: Mass.
Contact:

getting username...

Postby seplomaniac » Sat Jul 19, 2003 4:02 pm

OK, basically, i set up a sub-web in my site using FrontPage Extensions which requires authentication. Is there anyway i can get the username and output it with a script?

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Sat Jul 19, 2003 5:00 pm

There are actually many ways to do that.
Do you have any code? which database are you using ?
Give us a little bit more info.

seplomaniac
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Jul 19, 2003 4:00 pm
Location: Mass.
Contact:

Postby seplomaniac » Sat Jul 19, 2003 5:06 pm

well im making a site for a band, and i want to create a secure location for them to post news into a MySQL database. The problem is, i want something that says "posted by:member" under each news article and i want to do that by grabbing the username which was used to log into the subweb.

I tried:

Code: Select all

<?php
$user=$_SERVER['PHP_AUTH_USER'];
echo "logged in as: $user";
?>


but that didnt work :(

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Sat Jul 19, 2003 9:08 pm

Surprisingly, a quick Googling didn't turn up anything useful. I don't know anything about the FrontPage extensions, but it is probably the case that if any of the authentication information is available to PHP, you'll find it in the $_SERVER array. My recommendation is that you just dump the whole thing and see if you spot your username in there.

seplomaniac
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Jul 19, 2003 4:00 pm
Location: Mass.
Contact:

Postby seplomaniac » Sun Jul 20, 2003 10:06 am

Thanks for the suggestion, I found it. $_SERVER["REMOTE_USER"] pulls out the username.


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests