ivytony Posted January 26, 2008 Share Posted January 26, 2008 I don't really know how to phrase my question better, so let's put it this way: I have a cloaked affiliate link, say something like this http://www.mywebsite.com/affiliate_id=1000 for this actual affiliate link http://www.merchant1.com/index.php?affiliate=1000. A deal info is posted for this product: http://www.merchant1.com/categories/subcategories/products/hot/products1.html. When users click on this product link, I'd like them to be directed to http://www.merchant1.com/index.php?affiliate=1000 (through my cloaked link?) first so that my affiliate ID can be transmitted to the merchant. A few seconds later, the user will be redirected to the above product link for them to make purchases. I am wondering how I can do this in PHP? I'm not sure if I make myself understood ??? Thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/87868-how-to-redirect-from-one-page-to-another/ Share on other sites More sharing options...
hitman6003 Posted January 26, 2008 Share Posted January 26, 2008 you can redirect the user from page to page using the header command... header("location: page.php"); Quote Link to comment https://forums.phpfreaks.com/topic/87868-how-to-redirect-from-one-page-to-another/#findComment-449544 Share on other sites More sharing options...
ivytony Posted January 26, 2008 Author Share Posted January 26, 2008 but how do you control the time interval between the two redirections? thanks a lot! Quote Link to comment https://forums.phpfreaks.com/topic/87868-how-to-redirect-from-one-page-to-another/#findComment-449546 Share on other sites More sharing options...
p2grace Posted January 26, 2008 Share Posted January 26, 2008 You could use a sleep function. sleep(2); // will pause for two seconds before continuing header("location: page.php"); Quote Link to comment https://forums.phpfreaks.com/topic/87868-how-to-redirect-from-one-page-to-another/#findComment-449594 Share on other sites More sharing options...
ivytony Posted January 26, 2008 Author Share Posted January 26, 2008 wow, thank you so much! I appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/87868-how-to-redirect-from-one-page-to-another/#findComment-449600 Share on other sites More sharing options...
p2grace Posted January 26, 2008 Share Posted January 26, 2008 No problem If it works could you mark the topic as solved, thanks Quote Link to comment https://forums.phpfreaks.com/topic/87868-how-to-redirect-from-one-page-to-another/#findComment-449601 Share on other sites More sharing options...
ivytony Posted January 26, 2008 Author Share Posted January 26, 2008 But I think one more question for you: <?php header("Location: http://www.merchant1.com/index.php?affiliate=1000"); sleep(6); // will pause for 6 seconds before continuing header("location: http://www.merchant1.com/categories/subcategories/products/hot/products1.html"); ?> I have this above code in my redirection controller, I am wondering if it's correct. Because I can only see the products page without showing the merchant front page. Is this correct? thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/87868-how-to-redirect-from-one-page-to-another/#findComment-449606 Share on other sites More sharing options...
p2grace Posted January 26, 2008 Share Posted January 26, 2008 No, php will finish processing the code before it redirects. So once it redirects it doesn't know to finish processing the code. In other words you can't do two redirects from the same script. You'd need to redirect to a page, and from that page redirect again, or show the affiliate in an iframe or something so you can redirect the parent page. Quote Link to comment https://forums.phpfreaks.com/topic/87868-how-to-redirect-from-one-page-to-another/#findComment-449607 Share on other sites More sharing options...
laffin Posted January 26, 2008 Share Posted January 26, 2008 If the intermediate pages are on yer site, u can use something like html meta refresh tag providing u with the timeout u need as well as the redirect. however if the pages in question are not on yer site. you may have to use frames and some javascript. Quote Link to comment https://forums.phpfreaks.com/topic/87868-how-to-redirect-from-one-page-to-another/#findComment-449638 Share on other sites More sharing options...
rofl90 Posted January 26, 2008 Share Posted January 26, 2008 You'd have to sleep before doing the first header() i believe Quote Link to comment https://forums.phpfreaks.com/topic/87868-how-to-redirect-from-one-page-to-another/#findComment-449639 Share on other sites More sharing options...
laffin Posted January 26, 2008 Share Posted January 26, 2008 The link provided with the META tag dusn need sleep, it provides it for u. Quote Link to comment https://forums.phpfreaks.com/topic/87868-how-to-redirect-from-one-page-to-another/#findComment-449664 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.