15-04-2013, 04:03
(10-04-2013, 17:45)atp napisał(a): ...a nie możesz po prostu "pozbyć" się ciastka?czyli po modyfikacji powinno to wyglądać tak:
Kod:<?php
setcookie("mobile", "", time()-3600);
?>
Możesz zastosować np. takie coś:
Kod:<?php
if($_GET['mobile']=='off') {
setcookie("mobile", "", time()-3600);
}
?>
...i wtedy do full wersji wracasz linkiem typu: adresstrony.pl?mobile=off
Kod:
<?php
include 'path_to_mobile_detect_php_script/Mobile_Detect.php';
$detect = new Mobile_Detect();
$want_mobile = true;
if( isset($_COOKIE['mobile'] ) ){
if( $_COOKIE['mobile'] == "true" ){
$want_mobile = 1;
} else $want_mobile = 0;
if( isset( $_SERVER['HTTP_REFERER'] ) ){
$referer = $_SERVER['HTTP_REFERER'];
if( strpos( $referer, "mobile_site_url" ) ){
$want_mobile = 0;
if($_GET['mobile']=='off') {
setcookie("mobile", "false", time()+3600, "/", "site_url");
}
}
}
if ( $detect->isMobile() && $want_mobile ){
header('Location: http://mobile_site_url/', true, 302);
}
?>
jeśli tak to jest błąd:
Kod:
Parse error: syntax error, unexpected $end in /home/templates/cd4445/index.php on line 141