Hi fellow digitalpoint surfers, I have trying to learn how to redirect with php. This is what I want to do: 1. Users that comes from one of two specific domains AND use FireFox is redirected to http://www.somesite1.com 2. Users that comes from one of two specific domains AND use Opera is redirected to http://www.somesite2.com 3. Users that comes from one of two specific domains AND use something ELSE beside FireFox and Opera is redirected to http://www.somesite3.com 4. Users that don't have any referer is redirected to http://www.noneoftheabove.com This is what I got and it is not working: <?php $useragent = $_SERVER['HTTP_USER_AGENT']; $referer = $_SERVER['HTTP_REFERER']; if (strpos($useragent = 'Firefox')) { } if (strpos($referer = ('domain1.com','domain2.com'))) { header('Location: http://www.somesite1.com'); } if (strpos($useragent = 'Opera')) { } if (strpos($referer = ('domain1.com','domain2.com'))) { header('Location: http://www.somesite2.com'); } if (strpos($referer = ('domain1.com','domain2.com'))) { header('Location:http://www.somesite3.com'); } endif; { header('Location: http://www.noneoftheabove.com'); } ?> Can anyone help me? I would also like to add GeoIP since I have a subscription on MaxMind but the above is the most important for me. I would be happy to pay someone to create what I need!
<?php $browser = get_browser(null, true); if ($browser['browser'] == "Firefox") { header('Location: http://www.somesite1.com'); } elseif ($browser['browser'] == "IE") { header('Location: http://www.somesite2.com'); } elseif ($browser['browser'] == "Opera") { header('Location: http://www.somesite3.com'); } else { header('Location: http://somewhereelse.com'); } ?> PHP: Theres by user-agent
atlantaazfinest: Thank you, first part of the solution I have also added you to my MSN so we can talk. Anyone else that can help me with the rest?
This should work, dont think I have any typos..but look over just incase <?php $site1 = "http://www.whateversite.com"; $site2 = "http://www.whateversite2.com"; $site3 = "http://www.whateversite3.com"; $refer = $_SERVER['HTTP_REFERER']; $browser = get_browser(null, true); if ($refer == $site1 && $browser == "FireFox"){ echo '<meta http-equiv="refresh" content="0;url=http://www.somesite1.com">'; } elseif ($refer == $site2 && $browser == "IE"){ echo '<meta http-equiv="refresh" content="0;url=http://www.somesite2.com">'; } elseif ($refer == $site3 && $browser == "Opera"){ echo '<meta http-equiv="refresh" content="0;url=http://www.somesite3.com">'; }else{ echo '<meta http-equiv="refresh" content="0;url=http://www.somewhereelse.com">'; } ?> PHP: