Pages: [1] 2   Go Down
Send this topic | Print
Author Topic: Using a Normal Site and a Mobile Site  (Read 1120 times)
michaellindahl
Member
*
Offline Offline

Posts: 17


WWW
« on: September 15, 2008, 07:37:29 AM »

Hey I need some help,

When someone comes to my site, michaellindahl.com, If they are on a mobile device I want them to be redirected to mobile.michaellindahl.com, or michaellindahl.com/m/index.html, dont know which yet...

Thanks
Logged
Piotr GRD
Honoured 110MB Member
Official 110mb Guru
*****
Offline Offline

Posts: 6669



WWW
« Reply #1 on: September 15, 2008, 07:44:02 AM »

I am not familiar at all with websites for mobiles, but I guess that they have different User Agent strings than "normal" browsers. If yes, then using PHP or .htaccess you can redirect them basing on some keywords in the User Agent string.
Logged

aed
Oh My Goddess
Hyper-Active Member
***
Offline Offline

Posts: 130


-------------------


WWW
« Reply #2 on: September 16, 2008, 11:33:51 AM »

Here i use this code to detect if a user is using a mobile browser i  just fount it in the net! cheesy

Code:
function ismobile(){
  // check if the user agent value claims to be windows but not windows mobile
  if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce')){
    return false;
  }
  // check if the user agent gives away any tell tale signs it's a mobile browser
  if(eregi('up.browser|up.link|windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp|N70|S60|S40|S80|S90',$_SERVER['HTTP_USER_AGENT'])){
    return true;
  }
  // check the http accept header to see if wap.wml or wap.xhtml support is claimed
  if(stristr($_SERVER['HTTP_ACCEPT'],'text/vnd.wap.wml')||stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml')){
    return true;
  }
  // check if there are any tell tales signs it's a mobile device from the _server headers
  if(isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])||isset($_SERVER['X-OperaMini-Features'])||isset($_SERVER['UA-pixels'])){
    return true;
  }
  // build an array with the first four characters from the most common mobile user agents
  $a = array(
                    'acs-'=>'acs-',
                    'alav'=>'alav',
                    'alca'=>'alca',
                    'amoi'=>'amoi',
                    'audi'=>'audi',
                    'aste'=>'aste',
                    'avan'=>'avan',
                    'benq'=>'benq',
                    'bird'=>'bird',
                    'blac'=>'blac',
                    'blaz'=>'blaz',
                    'brew'=>'brew',
                    'cell'=>'cell',
                    'cldc'=>'cldc',
                    'cmd-'=>'cmd-',
                    'dang'=>'dang',
                    'doco'=>'doco',
                    'eric'=>'eric',
                    'hipt'=>'hipt',
                    'inno'=>'inno',
                    'ipaq'=>'ipaq',
                    'java'=>'java',
                    'jigs'=>'jigs',
                    'kddi'=>'kddi',
                    'keji'=>'keji',
                    'leno'=>'leno',
                    'lg-c'=>'lg-c',
                    'lg-d'=>'lg-d',
                    'lg-g'=>'lg-g',
                    'lge-'=>'lge-',
                    'maui'=>'maui',
                    'maxo'=>'maxo',
                    'midp'=>'midp',
                    'mits'=>'mits',
                    'mmef'=>'mmef',
                    'mobi'=>'mobi',
                    'mot-'=>'mot-',
                    'moto'=>'moto',
                    'mwbp'=>'mwbp',
                    'nec-'=>'nec-',
                    'newt'=>'newt',
                    'noki'=>'noki',
                    'opwv'=>'opwv',
                    'palm'=>'palm',
                    'pana'=>'pana',
                    'pant'=>'pant',
                    'pdxg'=>'pdxg',
                    'phil'=>'phil',
                    'play'=>'play',
                    'pluc'=>'pluc',
                    'port'=>'port',
                    'prox'=>'prox',
                    'qtek'=>'qtek',
                    'qwap'=>'qwap',
                    'sage'=>'sage',
                    'sams'=>'sams',
                    'sany'=>'sany',
                    'sch-'=>'sch-',
                    'sec-'=>'sec-',
                    'send'=>'send',
                    'seri'=>'seri',
                    'sgh-'=>'sgh-',
                    'shar'=>'shar',
                    'sie-'=>'sie-',
                    'siem'=>'siem',
                    'smal'=>'smal',
                    'smar'=>'smar',
                    'sony'=>'sony',
                    'sph-'=>'sph-',
                    'symb'=>'symb',
                    't-mo'=>'t-mo',
                    'teli'=>'teli',
                    'tim-'=>'tim-',
                    'tosh'=>'tosh',
                    'treo'=>'treo',
                    'tsm-'=>'tsm-',
                    'upg1'=>'upg1',
                    'upsi'=>'upsi',
                    'vk-v'=>'vk-v',
                    'voda'=>'voda',
                    'wap-'=>'wap-',
                    'wapa'=>'wapa',
                    'wapi'=>'wapi',
                    'wapp'=>'wapp',
                    'wapr'=>'wapr',
                    'webc'=>'webc',
                    'winw'=>'winw',
                    'winw'=>'winw',
                    'xda-'=>'xda-'
                  );
  // check if the first four characters of the current user agent are set as a key in the array
  if(isset($a[substr($_SERVER['HTTP_USER_AGENT'],0,4)])){
    return true;
  }
}
Logged
michaellindahl
Member
*
Offline Offline

Posts: 17


WWW
« Reply #3 on: September 18, 2008, 11:36:48 AM »

Here i use this code to detect if a user is using a mobile browser i  just fount it in the net! cheesy


Oh thanks! ...but where do I put it? before the body... I'm not very good at these html things...
Logged
Myles Grey
Full-Time Programmer
Super Authority member
******
Offline Offline

Posts: 1863


Programmer's Delight Release - 90%


WWW
« Reply #4 on: September 18, 2008, 12:04:13 PM »

Wow, that's great aed, I really wanted a script like that. Okay, micaellindahl, create a file named ismobile.php, give it these contents:

ismobile.php
Code:
<?php
function ismobile(){
&
#160; // check if the user agent value claims to be windows but not windows mobile
&#160; if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce')){
&#160; &#160; return false;
&#160; }
&#160; // check if the user agent gives away any tell tale signs it's a mobile browser
&#160; if(eregi('up.browser|up.link|windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp|N70|S60|S40|S80|S90',$_SERVER['HTTP_USER_AGENT'])){
&#160; &#160; return true;
&#160; }
&#160; // check the http accept header to see if wap.wml or wap.xhtml support is claimed
&#160; if(stristr($_SERVER['HTTP_ACCEPT'],'text/vnd.wap.wml')||stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml')){
&#160; &#160; return true;
&#160; }
&#160; // check if there are any tell tales signs it's a mobile device from the _server headers
&#160; if(isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])||isset($_SERVER['X-OperaMini-Features'])||isset($_SERVER['UA-pixels'])){
&#160; &#160; return true;
&#160; }
&#160; // build an array with the first four characters from the most common mobile user agents
&#160; $a = array(
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'acs-'=>'acs-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'alav'=>'alav',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'alca'=>'alca',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'amoi'=>'amoi',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'audi'=>'audi',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'aste'=>'aste',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'avan'=>'avan',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'benq'=>'benq',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'bird'=>'bird',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'blac'=>'blac',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'blaz'=>'blaz',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'brew'=>'brew',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'cell'=>'cell',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'cldc'=>'cldc',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'cmd-'=>'cmd-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'dang'=>'dang',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'doco'=>'doco',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'eric'=>'eric',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'hipt'=>'hipt',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'inno'=>'inno',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'ipaq'=>'ipaq',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'java'=>'java',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'jigs'=>'jigs',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'kddi'=>'kddi',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'keji'=>'keji',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'leno'=>'leno',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'lg-c'=>'lg-c',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'lg-d'=>'lg-d',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'lg-g'=>'lg-g',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'lge-'=>'lge-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'maui'=>'maui',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'maxo'=>'maxo',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'midp'=>'midp',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'mits'=>'mits',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'mmef'=>'mmef',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'mobi'=>'mobi',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'mot-'=>'mot-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'moto'=>'moto',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'mwbp'=>'mwbp',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'nec-'=>'nec-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'newt'=>'newt',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'noki'=>'noki',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'opwv'=>'opwv',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'palm'=>'palm',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'pana'=>'pana',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'pant'=>'pant',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'pdxg'=>'pdxg',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'phil'=>'phil',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'play'=>'play',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'pluc'=>'pluc',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'port'=>'port',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'prox'=>'prox',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'qtek'=>'qtek',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'qwap'=>'qwap',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sage'=>'sage',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sams'=>'sams',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sany'=>'sany',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sch-'=>'sch-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sec-'=>'sec-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'send'=>'send',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'seri'=>'seri',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sgh-'=>'sgh-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'shar'=>'shar',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sie-'=>'sie-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'siem'=>'siem',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'smal'=>'smal',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'smar'=>'smar',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sony'=>'sony',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sph-'=>'sph-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'symb'=>'symb',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 't-mo'=>'t-mo',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'teli'=>'teli',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'tim-'=>'tim-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'tosh'=>'tosh',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'treo'=>'treo',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'tsm-'=>'tsm-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'upg1'=>'upg1',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'upsi'=>'upsi',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'vk-v'=>'vk-v',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'voda'=>'voda',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'wap-'=>'wap-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'wapa'=>'wapa',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'wapi'=>'wapi',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'wapp'=>'wapp',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'wapr'=>'wapr',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'webc'=>'webc',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'winw'=>'winw',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'winw'=>'winw',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'xda-'=>'xda-'
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; );
&#160; // check if the first four characters of the current user agent are set as a key in the array
&#160; if(isset($a[substr($_SERVER['HTTP_USER_AGENT'],0,4)])){
&#160; &#160; return true;
&#160; }
}
?>


Then make it so that all of your regular pages have a .php extension, and put this at the top of them:

e.g. index.php
Code:
<?php
require_once "ismobile.php";
if (
ismobile() == true) {
 
header("location: http://mobile.michaellindahl.com/")
 exit;
}
?>

<html>
<heah><title>...</title><head>
<body>
<!-- normal HTML here -->
</body>
</html>
Logged

IE has the best Quirks
Almost every site you see runs on Quirks, not standards




Remember to mark your topic as [resolved]
aed
Oh My Goddess
Hyper-Active Member
***
Offline Offline

Posts: 130


-------------------


WWW
« Reply #5 on: September 18, 2008, 05:49:01 PM »

thats it Myles Grey thats exactly how i used it in my website....

Just put the code in top of every page or only in your main page because sometimes mobile users do like to view the Normal version of your site.

Logged
michaellindahl
Member
*
Offline Offline

Posts: 17


WWW
« Reply #6 on: September 19, 2008, 07:07:09 AM »

Wow, that's great aed, I really wanted a script like that. Okay, micaellindahl, create a file named ismobile.php, give it these contents:
ismobile.php

Then make it so that all of your regular pages have a .php extension, and put this at the top of them:
e.g. index.php

Um one problem maybe, I am using HTML, and it doesn't seem to work, and cant/dont want to change...
This is what the index.html file looks like...


Code:
?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
require_once "ismobile.php";
if (
ismobile() == true) {
 
header("location: http://mobile.michaellindahl.com/")
 exit;
}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
</title>
<meta http-equiv="refresh" content="0;url= mysite/welcome.html" />
<meta name="verify-v1" content="u0KtxmqUBERDONs+8ZALboe3RdTCQrcL71lOyF+yTkc=" />
</head>
<body>
</body>
</html>
« Last Edit: September 19, 2008, 07:08:52 AM by michaellindahl » Logged
codewhite
Advanced Authority Member
*****
Online Online

Posts: 1340


Violent Patient


WWW
« Reply #7 on: September 19, 2008, 07:17:42 AM »


Um one problem maybe, I am using HTML, and it doesn't seem to work, and cant/dont want to change...


All you need to do is change the extension from .html to .php no other changes are required.
Logged


I am a signature virus, copy me to your signature to spread me <Generation 0>
Increase Generation number each time I'm copied.
Codewhite Designs Cigar Journal On sale now.
michaellindahl
Member
*
Offline Offline

Posts: 17


WWW
« Reply #8 on: September 19, 2008, 07:25:28 AM »


Um one problem maybe, I am using HTML, and it doesn't seem to work, and cant/dont want to change...


All you need to do is change the extension from .html to .php no other changes are required.

It says this at michaellindahl.com
Parse error: syntax error, unexpected T_STRING in /www/110mb.com/m/i/c/h/a/e/l/l/michaellindahl/htdocs/index.php on line 1
Logged
codewhite
Advanced Authority Member
*****
Online Online

Posts: 1340


Violent Patient


WWW
« Reply #9 on: September 19, 2008, 07:30:47 AM »

Sorry, I missed the error in your code, you need to change

Code:
?xml version="1.0" encoding="UTF-8"?>

to

Code:
<?xml version="1.0" encoding="UTF-8"?>
Logged


I am a signature virus, copy me to your signature to spread me <Generation 0>
Increase Generation number each time I'm copied.
Codewhite Designs Cigar Journal On sale now.
michaellindahl
Member
*
Offline Offline

Posts: 17


WWW
« Reply #10 on: September 19, 2008, 07:54:21 AM »

Sorry, I missed the error in your code, you need to change

Sorry, I pasted incorrectly, it is that:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
require_once "ismobile.php";
if (
ismobile() == true) {
 
header("location: http://mobile.michaellindahl.com/")
 exit;
}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
</title>
<meta http-equiv="refresh" content="0;url= mysite/welcome.html" />
<meta name="verify-v1" content="u0KtxmqUBERDONs+8ZALboe3RdTCQrcL71lOyF+yTkc=" />
</head>
<body>
</body>
</html>
Logged
codewhite
Advanced Authority Member
*****
Online Online

Posts: 1340


Violent Patient


WWW
« Reply #11 on: September 19, 2008, 07:59:07 AM »

In that case try just removing that line from the code, I'm not sure it's needed.
Logged


I am a signature virus, copy me to your signature to spread me <Generation 0>
Increase Generation number each time I'm copied.
Codewhite Designs Cigar Journal On sale now.
michaellindahl
Member
*
Offline Offline

Posts: 17


WWW
« Reply #12 on: September 19, 2008, 08:19:35 AM »

In that case try just removing that line from the code, I'm not sure it's needed.

Parse error: syntax error, unexpected T_STRING in /www/110mb.com/m/i/c/h/a/e/l/l/michaellindahl/htdocs/index.php on line 6
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
require_once "ismobile.php";
if (
ismobile() == true) {
 
header("location: http://mobile.michaellindahl.com/")
 exit;
}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
</title>
<meta http-equiv="refresh" content="0;url= mysite/welcome.html" />
<meta name="verify-v1" content="u0KtxmqUBERDONs+8ZALboe3RdTCQrcL71lOyF+yTkc=" />
</head>
<body>
</body>
</html>
Logged
codewhite
Advanced Authority Member
*****
Online Online

Posts: 1340


Violent Patient


WWW
« Reply #13 on: September 19, 2008, 08:31:22 AM »

Parse error: syntax error, unexpected T_STRING in /www/110mb.com/m/i/c/h/a/e/l/l/michaellindahl/htdocs/index.php on line 6

Ok, this is a two part fix, first at the end of the line  header("location: http://mobile.michaellindahl.com/") you need to add ;
Code:
header("location: http://mobile.michaellindahl.com/");

Second, open the ismobile.php file and replace all the &#160; with a space.

That should have things working for you.
Logged


I am a signature virus, copy me to your signature to spread me <Generation 0>
Increase Generation number each time I'm copied.
Codewhite Designs Cigar Journal On sale now.
michaellindahl
Member
*
Offline Offline

Posts: 17


WWW
« Reply #14 on: September 19, 2008, 09:17:35 AM »

Parse error: syntax error, unexpected T_STRING in /www/110mb.com/m/i/c/h/a/e/l/l/michaellindahl/htdocs/index.php on line 6

Ok, this is a two part fix, first at the end of the line  header("location: http://mobile.michaellindahl.com/") you need to add ;
Code:
header("location: http://mobile.michaellindahl.com/");

Second, open the ismobile.php file and replace all the &#160; with a space.

That should have things working for you.


Nope!! go to michaellindahl.com to see the crazyness

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
require_once "ismobile.php";
if (
ismobile() == true) {
header("location: http://mobile.michaellindahl.com/");
 exit;
}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
</title>
<meta http-equiv="refresh" content="0;url= mysite/welcome.html" />
<meta name="verify-v1" content="u0KtxmqUBERDONs+8ZALboe3RdTCQrcL71lOyF+yTkc=" />
</head>
<body>
</body>
</html>
Code:
function ismobile(){
  // check if the user agent value claims to be windows but not windows mobile
  if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce')){
    return false;
  }
  // check if the user agent gives away any tell tale signs it's a mobile browser
  if(eregi('up.browser|up.link|windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp|N70|S60|S40|S80|S90',$_SERVER['HTTP_USER_AGENT'])){
    return true;
  }
  // check the http accept header to see if wap.wml or wap.xhtml support is claimed
  if(stristr($_SERVER['HTTP_ACCEPT'],'text/vnd.wap.wml')||stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml')){
    return true;
  }
  // check if there are any tell tales signs it's a mobile device from the _server headers
  if(isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])||isset($_SERVER['X-OperaMini-Features'])||isset($_SERVER['UA-pixels'])){
    return true;
  }
  // build an array with the first four characters from the most common mobile user agents
  $a = array(
                    'acs-'=>'acs-',
                    'alav'=>'alav',
                    'alca'=>'alca',
                    'amoi'=>'amoi',
                    'audi'=>'audi',
                    'aste'=>'aste',
                    'avan'=>'avan',
                    'benq'=>'benq',
                    'bird'=>'bird',
                    'blac'=>'blac',
                    'blaz'=>'blaz',
                    'brew'=>'brew',
                    'cell'=>'cell',
                    'cldc'=>'cldc',
                    'cmd-'=>'cmd-',
                    'dang'=>'dang',
                    'doco'=>'doco',
                    'eric'=>'eric',
                    'hipt'=>'hipt',
                    'inno'=>'inno',
                    'ipaq'=>'ipaq',
                    'java'=>'java',
                    'jigs'=>'jigs',
                    'kddi'=>'kddi',
                    'keji'=>'keji',
                    'leno'=>'leno',
                    'lg-c'=>'lg-c',
                    'lg-d'=>'lg-d',
                    'lg-g'=>'lg-g',
                    'lge-'=>'lge-',
                    'maui'=>'maui',
                    'maxo'=>'maxo',
                    'midp'=>'midp',
                    'mits'=>'mits',
                    'mmef'=>'mmef',
                    'mobi'=>'mobi',
                    'mot-'=>'mot-',
                    'moto'=>'moto',
                    'mwbp'=>'mwbp',
                    'nec-'=>'nec-',
                    'newt'=>'newt',
                    'noki'=>'noki',
                    'opwv'=>'opwv',
                    'palm'=>'palm',
                    'pana'=>'pana',
                    'pant'=>'pant',
                    'pdxg'=>'pdxg',
                    'phil'=>'phil',
                    'play'=>'play',
                    'pluc'=>'pluc',
                    'port'=>'port',
                    'prox'=>'prox',
                    'qtek'=>'qtek',
                    'qwap'=>'qwap',
                    'sage'=>'sage',
                    'sams'=>'sams',
                    'sany'=>'sany',
                    'sch-'=>'sch-',
                    'sec-'=>'sec-',
                    'send'=>'send',
                    'seri'=>'seri',
                    'sgh-'=>'sgh-',
                    'shar'=>'shar',
                    'sie-'=>'sie-',
                    'siem'=>'siem',
                    'smal'=>'smal',
                    'smar'=>'smar',
                    'sony'=>'sony',
                    'sph-'=>'sph-',
                    'symb'=>'symb',
                    't-mo'=>'t-mo',
                    'teli'=>'teli',
                    'tim-'=>'tim-',
                    'tosh'=>'tosh',
                    'treo'=>'treo',
                    'tsm-'=>'tsm-',
                    'upg1'=>'upg1',
                    'upsi'=>'upsi',
                    'vk-v'=>'vk-v',
                    'voda'=>'voda',
                    'wap-'=>'wap-',
                    'wapa'=>'wapa',
                    'wapi'=>'wapi',
                    'wapp'=>'wapp',
                    'wapr'=>'wapr',
                    'webc'=>'webc',
                    'winw'=>'winw',
                    'winw'=>'winw',
                    'xda-'=>'xda-'
                  );
  // check if the first four characters of the current user agent are set as a key in the array
  if(isset($a[substr($_SERVER['HTTP_USER_AGENT'],0,4)])){
    return true;
  }
}
Logged
codewhite
Advanced Authority Member
*****
Online Online

Posts: 1340


Violent Patient


WWW
« Reply #15 on: September 19, 2008, 09:36:19 AM »

Sorry, forgot to add that you need <?php at the beginning of the ismobile.php file and ?> at the end.

edited to add:

and get rid of the Â's use notepad or similar to replace them with spaces.
Logged


I am a signature virus, copy me to your signature to spread me <Generation 0>
Increase Generation number each time I'm copied.
Codewhite Designs Cigar Journal On sale now.
Myles Grey
Full-Time Programmer
Super Authority member
******
Offline Offline

Posts: 1863


Programmer's Delight Release - 90%


WWW
« Reply #16 on: September 19, 2008, 09:43:55 AM »

If you still want the XML line at the top (Recommended), put this at the top:

Code:
<?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?>

The error is caused because shorthand PHP (<? ... ?>) is turned on, which means the XML is parsed as PHP.
Logged

IE has the best Quirks
Almost every site you see runs on Quirks, not standards




Remember to mark your topic as [resolved]
michaellindahl
Member
*
Offline Offline

Posts: 17


WWW
« Reply #17 on: September 19, 2008, 10:14:52 AM »

If you still want the XML line at the top (Recommended), put this at the top:

Code:
<?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?>

The error is caused because shorthand PHP (<? ... ?>) is turned on, which means the XML is parsed as PHP.

Okay So it still gives me an error and this is what I have:
Code:
<?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
require_once "ismobile.php";
if (
ismobile() == true) {
header("location: http://michaellindahl.com/m/");
 exit;
}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
</title>
<meta http-equiv="refresh" content="0;url= mysite/welcome.html" />
<meta name="verify-v1" content="u0KtxmqUBERDONs+8ZALboe3RdTCQrcL71lOyF+yTkc=" />
</head>
<body>
</body>
</html>
Logged
robleyd
Official 110mb Guru
********
Online Online

Posts: 5700

Ask before you PM


« Reply #18 on: September 19, 2008, 10:25:52 AM »

The error is in ismobile.php, not your index.php. Show that script, exactly as it is on your site.
Logged

I once had a hard drive clunk-clicking
Strange noises, weird sounds and tick-ticking
I thought I would wait
And procrastinate...
But now all my data is missing
--------------
dd, a dump, a data dump
read a line from standard in
$USER, the name I call my self
make - a long long time to run
.so a library that is shared
.ko it's not the same as .so
tee, a redirect with in and out
and brings us back to dd d d d
michaellindahl
Member
*
Offline Offline

Posts: 17


WWW
« Reply #19 on: September 19, 2008, 10:29:44 AM »

The error is in ismobile.php, not your index.php. Show that script, exactly as it is on your site.

Code:
<?php
function ismobile(){
  
// check if the user agent value claims to be windows but not windows mobile
  
if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce')){
    return
false;
  }
  
// check if the user agent gives away any tell tale signs it's a mobile browser
  
if(eregi('up.browser|up.link|windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp|N70|S60|S40|S80|S90',$_SERVER['HTTP_USER_AGENT'])){
    return
true;
  }
  
// check the http accept header to see if wap.wml or wap.xhtml support is claimed
  
if(stristr($_SERVER['HTTP_ACCEPT'],'text/vnd.wap.wml')||stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml')){
    return
true;
  }
  
// check if there are any tell tales signs it's a mobile device from the _server headers
  
if(isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])||isset($_SERVER['X-OperaMini-Features'])||isset($_SERVER['UA-pixels'])){
    return
true;
  }
  
// build an array with the first four characters from the most common mobile user agents
  
$a = array(
                    
'acs-'=>'acs-',
                    
'alav'=>'alav',
                    
'alca'=>'alca',
                    
'amoi'=>'amoi',
                    
'audi'=>'audi',
                    
'aste'=>'aste',
                    
'avan'=>'avan',
                    
'benq'=>'benq',
                    
'bird'=>'bird',
                    
'blac'=>'blac',
                    
'blaz'=>'blaz',
                    
'brew'=>'brew',
                    
'cell'=>'cell',
                    
'cldc'=>'cldc',
                    
'cmd-'=>'cmd-',
                    
'dang'=>'dang',
                    
'doco'=>'doco',
                    
'eric'=>'eric',
                    
'hipt'=>'hipt',
                    
'inno'=>'inno',
                    
'ipaq'=>'ipaq',
                    
'java'=>'java',
                    
'jigs'=>'jigs',
                    
'kddi'=>'kddi',
                    
'keji'=>'keji',
                    
'leno'=>'leno',
                    
'lg-c'=>'lg-c',
                    
'lg-d'=>'lg-d',
                    
'lg-g'=>'lg-g',
                    
'lge-'=>'lge-',
                    
'maui'=>'maui',
                    
'maxo'=>'maxo',
                    
'midp'=>'midp',
                    
'mits'=>'mits',
                    
'mmef'=>'mmef',
                    
'mobi'=>'mobi',
                    
'mot-'=>'mot-',
                    
'moto'=>'moto',
                    
'mwbp'=>'mwbp',
                    
'nec-'=>'nec-',
                    
'newt'=>'newt',
                    
'noki'=>'noki',
                    
'opwv'=>'opwv',
                    
'palm'=>'palm',
                    
'pana'=>'pana',
                    
'pant'=>'pant',
                    
'pdxg'=>'pdxg',
                    
'phil'=>'phil',
                    
'play'=>'play',
                    
'pluc'=>'pluc',
                    
'port'=>'port',
                    
'prox'=>'prox',
                    
'qtek'=>'qtek',
                    
'qwap'=>'qwap',
                    
'sage'=>'sage',
                    
'sams'=>'sams',
                    
'sany'=>'sany',
                    
'sch-'=>'sch-',
                    
'sec-'=>'sec-',
                    
'send'=>'send',
                    
'seri'=>'seri',
                    
'sgh-'=>'sgh-',
                    
'shar'=>'shar',
                    
'sie-'=>'sie-',
                    
'siem'=>'siem',
                    
'smal'=>'smal',
                    
'smar'=>'smar',
                    
'sony'=>'sony',
                    
'sph-'=>'sph-',
                    
'symb'=>'symb',
                    
't-mo'=>'t-mo',
                    
'teli'=>'teli',
                    
'tim-'=>'tim-',
                    
'tosh'=>'tosh',
                    
'treo'=>'treo',
                    
'tsm-'=>'tsm-',
                    
'upg1'=>'upg1',
                    
'upsi'=>'upsi',
                    
'vk-v'=>'vk-v',
                    
'voda'=>'voda',
                    
'wap-'=>'wap-',
                    
'wapa'=>'wapa',
                    
'wapi'=>'wapi',
                    
'wapp'=>'wapp',
                    
'wapr'=>'wapr',
                    
'webc'=>'webc',
                    
'winw'=>'winw',
                    
'winw'=>'winw',
                    
'xda-'=>'xda-'
                  
);
  
// check if the first four characters of the current user agent are set as a key in the array
  
if(isset($a[substr($_SERVER['HTTP_USER_AGENT'],0,4)])){
    return
true;
  }
}
?>
Logged
Pages: [1] 2   Go Up
Send this topic | Print
Jump to: