Digital Point Forums
Winn and Sims

Go Back   Digital Point Forums > Design & Development > Programming > PHP
Google Analytics
Log In to view
your analytics

Reply
 
Thread Tools
  #1  
Old May 9th 2008, 7:32 am
johnsmith153 johnsmith153 is offline
Peon
 
Join Date: May 2008
Posts: 16
johnsmith153 is on a distinguished road
$addressbar = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER

<?php
$addressbar = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
echo $addressbar;
?>

Is this reliable? I need to grab certain parts of the address bar in my php code.

If I can not get the address bar info, my site would hardly work.

I have heard how sometimes php cant pick up on this info, but I may be thinking of something else.

I am not bothered about security (as I know these things can easily be changed) - if someone wants to prevent it being sent then they just wont see my site - however I want to ensure genuine users are not prevented by no fault of their own.

I.e AOL users for example get a weird experience / IP address change etc. Just want to make sure there isn't some sort of thing where address bar info can not be picked up and by no fault of the user.

Just a quick YES would be fine if I should go ahead with this. If I see a load of YES posts that is enough for me. Although if not sure, don't post. Thanks.
Reply With Quote
  #2  
Old May 9th 2008, 7:50 am
jestep's Avatar
jestep jestep is offline
of the Nightfall
 
Join Date: Dec 2004
Location: Austin
Posts: 2,398
jestep is a name known to alljestep is a name known to alljestep is a name known to alljestep is a name known to alljestep is a name known to alljestep is a name known to all
Those should work fine. If you're ever in question for a specific server, open up a phpinfo() and look under PHP Variables.
Reply With Quote
  #3  
Old May 9th 2008, 1:49 pm
jayshah's Avatar
jayshah jayshah is offline
of the Nightfall
 
Join Date: Jan 2008
Location: London, UK
Posts: 1,128
jayshah is a jewel in the roughjayshah is a jewel in the roughjayshah is a jewel in the rough
Yes, it'll always work. The server variables are always assigned by PHP at runtime and will always be present, and can never be altered.

Jay
__________________
Jay Shah
MyCoHost - User Mode Linux VPS (DP Review)() - No OpenVZ = No Overselling

Managed VPS's with cPanel/WHM, Fantastico, WHM Master Resellers & RVSkins!
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Modrewite ~ $_SERVER["REQUEST_URI"] ~ $_SERVER["PHP_SELF"] Colbyt Apache 1 Mar 2nd 2008 3:35 pm
Question on $_SERVER['PHP_SELF'] cpthk PHP 10 Dec 27th 2007 10:21 am
Http-referer Vs $_server['request_uri'] ProductivePC PHP 10 Oct 18th 2007 6:28 am
If $_SERVER["SERVER_NAME"] glasglow PHP 5 Jun 19th 2007 3:19 pm
PHP $_Server info? Weirfire PHP 3 Mar 29th 2005 9:06 am


All times are GMT -8. The time now is 12:34 am.