<a href="self.php?desktop=1">Switch to desktop</a>
<?php
if(!isset($_SESSION['desktop'])) {
$_SESSION['desktop'] = false;
}
if(isset($_GET['desktop']) && $_GET['desktop'] == 1) {
$_SESSION['desktop'] = true;
}
if(!$_SESSION['desktop']) {
if ( !$detect->isMobile() ) {
//the link to mobile site
}
}
On your mobile site you give the opportunity to people to switch to desktop (the page where the redirect is done) with passing a get parameter of desktop=1
. Normally, if the parameter is not passed, and if the session is not set, it's false. On false value of $_SESSION['desktop'], you continue your script so it redirects to mobile. But once the param is passed, it changes the session to true, and you block will not be executed, so the normal (desktop) content of the site will be visible