Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Mobile Marketing (https://www.warriorforum.com/mobile-marketing/)
-   -   Mobile re-direct script (https://www.warriorforum.com/mobile-marketing/557544-mobile-re-direct-script.html)

IWelcomesocialmedia 9th March 2012 09:45 AM

Mobile re-direct script
 
Hi can someone help with this question please.

I am using Quentin's mobile site builder.

I now have to re-direct the mobile site to the main CRM site. Is there a script for this? and where can i get one from?

Thanks in advance.

The main site in not WP.

Regards
Para

ryankjones 9th March 2012 10:11 AM

Re: Mobile re-direct script
 
<?php
class Mobile {

/**
* @author Webarto.com
* @version 1.1 (added force parameter to force non mobile version on mobile devices)
* @copyright 2011
*/

public $agent;
public $device;

public function check()
{

$this->agent = $_SERVER['HTTP_USER_AGENT'];
$agent = $this->agent;
$mobile = false;

if($_GET['force'] == 1){
setcookie('force', 1, 0, '/', '.'.$_SERVER['HTTP_HOST']);
return;
}
if($_COOKIE['force'] == 1) return;

$agents = array(
'Android',
'Acer',
'Asus',
'Alcatel',
'Blackberry',
'HTC',
'HP',
'Huawei',
'LG',
'Motorola',
'Nokia',
'Palm',
'Samsung',
'SonyEricsson',
'ZTE',
'Mobile',
'iPhone',
'iPod',
'iPad',
'Mini',
'Playstation',
'DoCoMo',
'Benq',
'Vodafone',
'Sharp',
'Kindle',
'Nexus',
'Windows Phone'
);

foreach($agents as $a){
if(stripos($agent, $a) !== false){
$mobile = true;
$this->device = $a;
}
}

return $mobile;

}

public function redirect($url)
{
header('Location: '.$url);
}

}
?>

ryankjones 9th March 2012 10:12 AM

Re: Mobile re-direct script
 
Put that at the top of your page

IWelcomesocialmedia 9th March 2012 11:43 AM

Re: Mobile re-direct script
 
Quote:

Originally Posted by ryankjones (Post 5792751)
Put that at the top of your page

Hi Ryan

Thank you.


I got one from within the members area of Quentin's Mobile membership site.

Thank you
Regards
Para


All times are GMT -6. The time now is 09:51 PM.