Reply 323284 to: Editor tema blocked, devo fare lavori su header.php

Avatar: cwagencyit
cwagencyit
Participant
May 6, 2022 at 10:09

I need to block the desktop view of the site, I have to insert this php in the header.php, but it doesn’t let me insert it!

function isMobileDevice(){
$aMobileUA = array(
‘/iphone/i’ => ‘iPhone’,
‘/ipod/i’ => ‘iPod’,
‘/ipad/i’ => ‘iPad’,
‘/android/i’ => ‘Android’,
‘/blackberry/i’ => ‘BlackBerry’,
‘/webos/i’ => ‘Mobile’
);

//Return true if Mobile User Agent is detected
foreach($aMobileUA as $sMobileKey => $sMobileOS){
if(preg_match($sMobileKey, $_SERVER[‘HTTP_USER_AGENT’])){
return true; //telefono o tablet
}
}
//Otherwise return false..
return false; //fai il redirect o mostri la pagina di errore
}

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.