Code: Select all
$url = $_GET['url'];
if ($url == "http://www.site.co.uk")
{
echo "<meta http-equiv='Refresh' content='0 ;URL=$url;'>";
}
else
{
$newstring = substr_replace($url, 'www', 7, 1);
echo "<meta http-equiv='Refresh' content='0 ;URL=$newstring'>";
}
They click normal and it takes them here.
Since the URL they were at is http://www.site.co.uk then the top query should run and take them back to the homepage of the normal site.
Else, it should take them to the second query, which changes the URL, and replaces the m (http://m.site.co.uk) with the 'www'.
If I echo $url on the page, it shows http://www.site.co.uk, but the query still opts for the second "else" option each time. I cannot see why.
This is the full code:
Code: Select all
if(isset($cookiesite))
{
$url = $_GET['url'];
if ($cookiesite == "mobile")
{
$newstring = substr_replace($url, 'm', 7, 3);
echo "<meta http-equiv='Refresh' content='50 ;URL=$newstring'>";
}
if ($cookiesite == "normal")
{
echo "$url<br/>";
if ($url == "http://www.site.co.uk") { $point = "normalhome";}
if ($point == "normalhome")
{
echo "One moment - redirecting to $url<br/>";
echo "<meta http-equiv='Refresh' content='5 ;URL=http://www.site.co.uk'>";
}
else
{
$newstring = substr_replace($url, 'www', 7, 1);
echo "One moment - redirecting to $newstring";
echo "<meta http-equiv='Refresh' content='5 ;URL=$newstring'>";
}
}
}