Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Php Url Detection?

(141 views • 2 replies)

This topic is 1 page long.

<< < > >>
Questioning

azrag

Reply To Post Reply & Quote

Posted at: 8/4/07 03:10 AM

azrag NEUTRAL LEVEL 13

Sign-Up: 08/26/03

Posts: 1,132

hey guys im curious if there is a function in php that allows it to detect what the current url is that the user is on. For example if the browser says your on http://newgrounds.com/tomnaked.php can php echo that url and if so how?

ITS OVER 9000!!!!!!!!!!! 8========D !!!!!!!!!!!!!!!! NIGG@H!!!!!!! MOAR RACISM!!!!!!!!!!!!!


None

Afro-Ninja

Reply To Post Reply & Quote

Posted at: 8/4/07 04:48 AM

Afro-Ninja EVIL LEVEL 35

Sign-Up: 03/02/02

Posts: 13,074

$url = 'http';
if($_SERVER['HTTPS']=='on')$url .= 's';
$url .= '://';
$url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
echo $url;

the url starts with http, then adds an s if 'https' is on (secure socket)
then it adds :// regardless. http_host retrieves your site url, then request_uri gets the rest for you, including the query string if there is one.

if you want the query string separate you can use PHP_SELF for just the file name, and QUERY_STRING for the.. query string

BBS Signature

None

azrag

Reply To Post Reply & Quote

Posted at: 8/4/07 06:54 AM

azrag NEUTRAL LEVEL 13

Sign-Up: 08/26/03

Posts: 1,132

ah dude that helped so much thanks

ITS OVER 9000!!!!!!!!!!! 8========D !!!!!!!!!!!!!!!! NIGG@H!!!!!!! MOAR RACISM!!!!!!!!!!!!!


All times are Eastern Daylight Time (GMT -4) | Current Time: 04:48 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!