Jump to content

get url


dreamwest

Recommended Posts

REMOTE_ADDR gets you a users ip address, not a url of any kind. Maybe you where thinking of HTTP_REFERER, but even then, it simply gets the refering address, not the current. Maybe you where thinking of REMOTE_HOST, again, this relates to the client.

 

Maybe your looking for combination of SERVER_NAME, REQUEST_URI and QUERY_STRING?

Link to comment
https://forums.phpfreaks.com/topic/172107-get-url/#findComment-907418
Share on other sites

$scheme = !empty($_SERVER['HTTPS']) && 'on' === $_SERVER['HTTPS'] ? 'https' : 'http';
echo $scheme, '://', $_SERVER['HTTP_HOST'], $_SERVER['SCRIPT_NAME'];

 

Almost what im looking for.. Im trying to track ppl trying to hack my site

 

I have this in htaccess: ErrorDocument 404 /404.php , so whenever someone tries to guess urls:

 

http://site.com/admin/something.php it will automatically go to http://site.com/404.php. But  $_SERVER['HTTP_REFERER']; isnt working for this.

 

Link to comment
https://forums.phpfreaks.com/topic/172107-get-url/#findComment-907425
Share on other sites

$_SERVER['HTTP_REFERER'] will get you the site the visitor came from if they clicked a link to your site. Provided of course there browser sends this information.

 

What information are you after exactly? keep in mind that anyone who knows anything about cracking websites won't send very much real information in there requests at all.

Link to comment
https://forums.phpfreaks.com/topic/172107-get-url/#findComment-907440
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.