Needs Quick Some Easy PHP Help

projectv3

New member
Mar 6, 2007
506
2
0
I'm not really fluent in PHP and I have an idea how to do this but I just cant seem to get it down right.

What I want to do:

Have redirect.php meta refresh (needs to be meta refresh, header wont work) to a tracking url based on what variable offer = , as well as pass the kw variable into the tracking url.

ex/

given redirect.php?offer=001&kw=wickedfire
-> redirect.php selects the offer under 001 then meta refreshes to that link while passing through kw=wickedfire

What I have so far:

PHP:
<?
$kw = $_GET['t202kw'];
$offer = $_GET['offer'];

 if ($offer == "001")
    {$jumplink= "http://tracker.com/tracking202/redirect/dl.php?t202id=1264&t202kw=$kw";}
    
 if ($offer == "002")
    {$jumplink= "http://tracker.com/tracking202/redirect/dl.php?t202id=1264&t202kw=$kw";}
What I'm stuck on:

how to do the meta refresh, and how to correctly pass the $kw, I'm guessing I need to throw an echo in there?

If anyone could spare a few seconds it'd be much appreciated, since its been driving me crazy trying to google all the parts together while checking for lil syntax errors... lol

*edit my bad about the title, Just realized there is some major grammar issues there - damn jetlagg...
 


sorry bout the coloring, realized its kinda hard to read, I guess the [ php] code changes it up automatically...
 
ok ignore this i'm retarded right now due to some 12hr difference worth of jetlag, header(...) does work for what i need to do :D
 
Well for one, if you pass &kw= you would need to use $_GET['kw'] not $_GET['t202kw']

A meta refresh can be simply done with:

Code:
<html>
    <head>
        <meta http-equiv="refresh" content="5;url=<?=$jumplink;?>"/>
        <title>Redirecting...</title>
    </head>
    <body>Your Redirect Message here</body>
</html>

I havent confirmed this 100% but the reason why you want to give it a couple seconds (above is set for 5) is because on some browsers anything under 3 seconds will still pass the referrer.

This is what I'd do, a javascript redirect with a meta refresh as a backup.

Code:
<html>
    <head>
        <meta http-equiv="refresh" content="5;url=<?=$jumplink;?>"/>
        <title>Redirecting...</title>
        <script type="text/javascript">
        <!--
              window.location = "<?=$jumplink;?>";
         //-->
        </script>
    </head>
    <body>Your Redirect Message here</body>
</html>

A javascript redirect is essentially the same thing as someone typing into the address bar so no referrer or such is passed. Above would immediately try to do the javascript redirect, but if that fails (ie: someone has js disabled) it can still fall back on the meta refresh.
 
sweet, that sounds so much better than the beat up job i came up with lol

outta curiosity how would i incorporate the "if offer == x, then $jumplink ==" part into that last part which you included the java as well?

Thanks kblesinggr! Definitely appreciated!