Enjoy unlimited access to all forum features for FREE! Optional upgrade available for extra perks.

Putting URL on page

Status
Not open for further replies.
Joined
Sep 13, 2005
Posts
2,484
Reaction score
103
Anyone know if it's possible to automatically put the current URL into the page. Say I want a landing page with the domain on it, but don't want to handcraft each page for each domain.

Thanks in advance
Johnny
 
Code:
<?php
echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
?>

That should do it..
 
I always use HTTP_HOST & PHP_SELF, I use PHP_SELF in forms as well as the place to submit it. Sometimes request URI has a habit of going pear shaped or returning fubar data.
 
Just use HTTP_HOST or SERVER_NAME, if you create a file called

info.php and put in it

<?php

phpinfo();

?>

That shows you call the info thats easily accessible :)
 
Skinner, have you got an example page with it on? I'm not too skilled in php.
 
<html>
<head>
<title>title here</title>
</head>
<body>
You are currently browsing: <?php echo $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; ?>.
</body>
</html>

http://www.skindustrial.com/rat.php

Simple example typed off the top of my head :)
 
Last edited:
$HTTP_HOST ought to just do the domain itself, explode() off the www or regex it to strip out the rubbish.

If you are building a holding page for names it is worth logging everything eg.

$date = date("l dS of F Y h:i:s A");
$ip = $_SERVER['REMOTE_ADDR'];
$browser = $HTTP_USER_AGENT;
$os = $_ENV["OS"];
$referer = $HTTP_REFERER ;
$searchterm = "FRONTPAGE";

Nice and handy to find out who is visiting site, where they have come from, what they did prior to contacting you etc etc. Logging IP's can be handy to see previous visits as well.

Others do things far more in depth than the above, but it can be very handy :)
 
Poo I forgot to include the one without the file name.

Just remove the . $_SERVER['PHP_SELF'] to display just the address.

Also further to robs post may wanna look at

$_ENV["HTTP_USER_AGENT"]

Which includea the OS and some other info :)
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Featured Services

Sedo - it.com Premiums

IT.com

Premium Members

AucDom
UKBackorder
Be a Squirrel

Latest Comments

Acorn Domains Merch
MariaBuy Marketplace

New Threads

Domain Forum Friends

Other domain-related communities we can recommend.

Our Mods' Businesses

Perfect
Service
Laskos
URL Shortener
*the exceptional businesses of our esteemed moderators
Top Bottom