Page 1 of 1

$REMOTE_USER on the page

Posted: Fri May 30, 2003 8:37 am
by pama
hi everyone,
anybody knows how to change view of $REMOTE_USER (NT) on the page?
I have

Code: Select all

<?php printf("$REMOTE_USER") ?>
and on the page is "domain_name\\user_name". Is possible to show only "username"?
Thanks :)

Posted: Fri May 30, 2003 8:52 am
by stuart
a quick, easy, answer would be to strip out the domain_name\\ part (if it exists) with regular expressions :)

Posted: Fri May 30, 2003 8:57 am
by pama
not possibile, but really easy :)
anyone?

Posted: Fri May 30, 2003 9:07 am
by patrikG
Try parse_url and Bob or whoever the user is, is your uncle :)

Posted: Fri May 30, 2003 9:23 am
by pama
maybe it's possibile, but...
1. i'm newbie
2. domain name is not url :(
3. i can't do it

Posted: Fri May 30, 2003 9:33 am
by twigletmac
Well you shouldn't need a regular expression for this, explode() could do it:

Code: Select all

$info = explode('\'', $_SERVER['REMOTE_USER']);
$username = $info[1];
echo $username;
Mac

Posted: Mon Jun 02, 2003 12:46 am
by pama
twigletmac wrote:Well you shouldn't need a regular expression for this, explode() could do it:

Code: Select all

$info = explode('\'', $_SERVER['REMOTE_USER']);
$username = $info[1];
echo $username;
Mac
hi, thanks for this code :D
i can use it but with one change, should be:

Code: Select all

$username = $info&#1111;2];
than i have username without domain name... :)

Posted: Mon Jun 02, 2003 3:19 am
by twigletmac
Not sure why it's $info[2] - you should only have 2 elements in the array but hey, if it works...

Mac