Wouldn’t it be enough to switch mobile/desktop via a $_SESSION variable, make the “switch to desktop link” include something like ?switchtodesktop=1
and have the header contain something like
session_start();
if ($_GET['switchtodesktop']) {
$_SESSION['switchtodesktop'] = true;
}
$desktop = isset($_SESSION['switchtodesktop']);
[...]
if ($desktop) {
// only desktop css without media queries
} else {
// default stuff (media queries, like you have now ..)
}