Jump to content

question on php ability?


Porkie

Recommended Posts

you could create a link like <a href="ref.php?code=google">www.google.co.uk</a>

 

then on ref.php it gets the url requested

 

$code = $_GET['code'];

//$code contains google

then you could do a switch statement to check for various links you may have then do what ever your going to do then either direct the page to the link using a header or a text link,button.

Link to comment
Share on other sites

You would have to change the link on your page to go to your intercept page, pass in the desired url and do a refresh on a timeout or something;

 

on your main page the link would be something like this:

<A href=myIntercept.php?dest=www.google.co.uk>Google Roundabout</A>

 

the myIntercept.php would have to do something along these lines (this is just an outline, you'll have to flesh it out)

<?php
// Get the user's ultimate destination
$dest = $_GET['dest'];

// Now show them my page
?>
<HTML>
  <HEAD>
    <TITLE>INTERCEPTED!!!</TITLE>
    <!-- Here's where we forward them on to their destination -->
    <META http-equiv="refresh" content="10;url=http://<?php echo $dest;?>">
  </HEAD>
  <BODY>
    <H1>INTERCEPTED!!!</H1>
    <P>I just wanted to see your pretty face before you ran off to <?php echo $dest; ?></P>
  </BODY>
</HTML>

 

In the META refresh tag, the number 10 in the example above is the number of seconds to delay before refreshing the page.  The url specifies the page that the refresh will open.

 

You can't use a header('Location ...') call here if you want to display anything to the user because the header redirect will happen before the page gets loaded.  If you just want to track the links and not show something, you can use the header after you have done all of your tracking code.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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