Script

Show Script

Showing code for: desktop.irev

Back

<?rev 
   -- the re-direct has to be before anything else is written to the page, so it comes here, before the header
   put "iPhone,iPod,UP.Browser,Blackberry,Opera Mini,HTC,Windows CE,IEMobile,LG-,WAP2,MOT-," into tMobileDevices
   put "Nokia,Symbian,SAMSUNG-,NetFront,SonyEricsson" after tMobileDevices

   put $_SERVER["HTTP_USER_AGENT"] into tUserAgent
   put false into tMobileDevice
   
   repeat for each item i in tMobileDevices
      if tUserAgent contains i then
         put "http://www.troz.net/onrev/samples/mobile.irev" into tMobilePage
         put new header "Status: 301 Moved Permanently"
         put new header "Location:" && tMobilePage
         put true into tMobileDevice
      end if
   end repeat


command recordVisitors
   -- this is here so I can check that the various user agents are being sent to the right page
   put $_SERVER["DOCUMENT_ROOT"] into tPath
   put tPath & "data/desktop_hits.txt" into tHitsFile

   put $_SERVER["REMOTE_ADDR"] into tRemAddr
   put $_SERVER["HTTP_USER_AGENT"] into tAgent
   put the long date & tab & the long time into tHitTime
   
   put URL ("file:" & tHitsFile) into tHits
   put tRemAddr & tab & tAgent & tab & tHitTime & cr after tHits
   put tHits into URL ("file:" & tHitsFile)
end recordVisitors

?>

<?rev
   -- Standard header -------------------------------
   put "Troz : : On-Rev" into tHeader
   include "../../includes/header.irev"
   
   include "../../includes/menu.irev"
   --------------------------------------------------
?>

   <?rev include "includes/scriptlink.irev" ?>
   <h1>Desktop Page</h1>
   
   <p>If you are reading this, the server has not detected that you are using a mobile device to access the site.</p>
   
   <div class="info">
   If this is incorrect, please 
   <a href="mailto:&#115;&#97;&#114;&#00097;&#00104;&#064;&#116;&#00114;&#111;&#00122;&#00046;n&#00101;&#0116;?subject=Mobile%20device%20not%20detected">email me</a>
    and I will try to fix it.
   <p>
   It would help if you included the following data in your email: <br />
      <pre>HTTP_USER_AGENT: <?rev put $_SERVER["HTTP_USER_AGENT"] ?></pre>
   </div>
      
   <?rev if tMobileDevice = false then recordVisitors ?>


<?rev
   -- Standard footer -------------------------------
   include "includes/showIncludes.irev"
   include "../../includes/footer.irev"
   --------------------------------------------------
?>