Jump to content

[SOLVED] Redirection Problem


e1seix

Recommended Posts

I have a bit of a problem...

 

I have over 3000 potential redirection in a database... with the wrong address! The shame!

 

What my code does is request this from mySQL and then it redirects to the site. So write up a simple "if" statement? Not possible, as every one of these links to a product with an individual 4 digit code.

 

What I need your help with is a code that will use the $_GET statment to request the "id" (4 digit code) and redirect accordingly with the new file path.

 

Is this possible?

 

Example:

 

This is the incorrect file path...

http://www.cheapsmells.com/product_show_new.asp?id=5696&ref=webgains&siteid=20592

 

This is the correct file path...

http://www.awin1.com/awclick.php?awinmid=911&awinaffid=74040&p=http://www.cheapsmells.com/viewProduct.php?id=5696

 

How can I allow the original link to go to the address bar and then redirect it using the $_GET function to the correct site?

 

Many thanks,

Link to comment
https://forums.phpfreaks.com/topic/72915-solved-redirection-problem/
Share on other sites

OK, I've thought of my own potential solution.

 

the 4 digit number has be between 0000 & 9999

 

I could run a simple "if" statement to say for example

 

If { (madeupurl == 'http://www.cheapsmells.com/product_show_new.asp?id=[$variable]&ref=webgains&siteid=20592'

 

echo '<a href="http://www.awin1.com/awclick.php?awinmid=911&awinaffid=74040&p=http://www.cheapsmells.com/viewProduct.php?id=[$variable]" target="_new">Link</a>';

}

 

and simply declare $variable as some loop that will search for all numbers between the parameters of 0000 & 9999, hold that specific number, and redirect

 

Can someone help me write this code. While I can figure out the solution, the execution is a little beyond me...  :P

 

no you'll need to explain that one a bit furher... lol

 

see if you can make sense of this instead...

 

$starter = 1;

$code = ($starter > 0) && ($starter < 9999);

$cheapsmells3=('http://www.cheapsmells.com/product_show_new.asp?id=".$code."/ref=webgains&siteid=20592');

 

if ($row['buy_link'] == $cheapsmells3) {

    // has remainder so add one page

    echo '<a href="http://www.awin1.com/awclick.php?awinmid=911&awinaffid=74040&p=http://www.cheapsmells.com/viewProduct.php?id='.$code.'" target="_new">';

    echo '<img alt="BUY" height="15" src="/BUY.gif" target="_new" width="50"

/></a>';

}

 

else { echo '<a href="'.$row['buy_link'].'" target="_new">';

    echo '<img alt="BUY" height="15" src="/BUY.gif" target="_new" width="50"

/></a>';

}

 

i'm trying to enable it to lift the variable $code from the filepath - it's a number between 0000 & 9999 - and implement it into the "if" statement

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.