Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

Putting URL on page

Status
Not open for further replies.
Joined
Sep 13, 2005
Posts
2,479
Reaction score
104
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!

Members online

Premium Members

Latest Comments

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom