-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
45 lines (37 loc) · 1.16 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
include("Mobile_Detect.php");
$detect = new Mobile_Detect();
// Set the cache control header (1 month is good for images)
// (Please note that the Expires HTTP header should also be set in real life)
header("Cache-Control: max-age=60");
// Set the Vary HTTP header. Detection is made on the User-Agent HTTP header
header("Vary: User-Agent");
if (isset($_GET['m'])) { // We have a value directly from the user that we need to store
setcookie('m', $_GET['m'], time()+60*60*24*30); // Although we may already have a cookie, the value may
$_COOKIE['m'] = $_GET['m'];
$mobile_browser = $_COOKIE['m'];
}
else if (isset($_COOKIE['m'])) {
$mobile_browser = $_COOKIE['m'];
}
else {
$mobile_browser = 0;
}
//echo "mob ".$mobile_browser;
$domain= "http://s388430620.websitehome.co.uk/";
$path= "gol/";
$base = $domain . $path;
//echo "base ".$base;
if($mobile_browser==1){
// serve up the mobile brew
$redirect = $base.'mobile.html';
header("Location: $redirect");
//echo "mobile ". $mobile_browser;
}
else if($mobile_browser==0){
// serve up the desktop brew
$redirect = $base.'desktop.html';
header("Location: $redirect");
//echo "desktop " . $mobile_browser;
}
?>