Jump to content

Replace text using php


leachus2002

Recommended Posts

Hi There,

 

I am developing an internal web page on our intranet - and I am using the $_SERVER['REMOTE_USER'] varible to pass through who is logged on to a particular web page. Unfortunaetly, if I echo this on to the screen, it displays "domainname/username" - is there any way that I can remove the "domainname/" from the start of the string so that it just echo's "username"?

 

Help appreciated

 

Thanks

Matt

Link to comment
Share on other sites

Thanks for coming back to me, however, I think I am getting confused:

 

Where I am using the "$_SERVER['REMOTE_USER']" varible, would i have to code the following:

 

$result = "
$_SERVER['REMOTE_USER']";
$username = explode("/", $result);
print $username[1];

 

Because the user will always be different

 

Thanks

 

Matt

Link to comment
Share on other sites

Sorry to be a pain - but is there any way I can get that print line in to a varible? I have tried $user = print username[1]; echo $user - but that will echo username1

 

Thanks

Matt

 

You'd need to do echo $username[1]. Echo and print are pretty much the same thing.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.