Redirect mobile users to a mobile friendly page with php

After allot of trial and error I ended up coming up with some code that will redirect users to a mobile friendly page, this method won’t really be useful in about 5 years because modern browsers like safari allow full page viewing but this will get you by until then. Remember this code will have to change constantly if you want to stay up to date with the latest hand held devices and mime types.

To get started all you have to do is place the following code in the stop of your php page. If your loading an application you can post this below your application just don’t output any data before the code is executed. To get started making mobile friendly pages you can purchase your domain names and hosting by clicking here.


$mobile_browser = '0';if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i',
strtolower($_SERVER['HTTP_USER_AGENT']))){
$mobile_browser++;
}

if((strpos(strtolower($_SERVER[‘HTTP_ACCEPT’]),’application/vnd.wap.xhtml+xml’)>0) or
((isset($_SERVER[‘HTTP_X_WAP_PROFILE’]) or isset($_SERVER[‘HTTP_PROFILE’])))){
$mobile_browser++;
}

$mobile_ua = strtolower(substr($_SERVER[‘HTTP_USER_AGENT’],0,4));
$mobile_agents = array(
‘w3c ‘,’acs-‘,’alav’,’alca’,’amoi’,’audi’,’avan’,’benq’,’bird’,’blac’,
‘blaz’,’brew’,’cell’,’cldc’,’cmd-‘,’dang’,’doco’,’eric’,’hipt’,’inno’,
‘ipaq’,’java’,’jigs’,’kddi’,’keji’,’leno’,’lg-c’,’lg-d’,’lg-g’,’lge-‘,
‘maui’,’maxo’,’midp’,’mits’,’mmef’,’mobi’,’mot-‘,’moto’,’mwbp’,’nec-‘,
‘newt’,’noki’,’oper’,’palm’,’pana’,’pant’,’phil’,’play’,’port’,’prox’,
‘qwap’,’sage’,’sams’,’sany’,’sch-‘,’sec-‘,’send’,’seri’,’sgh-‘,’shar’,
‘sie-‘,’siem’,’smal’,’smar’,’sony’,’sph-‘,’symb’,’t-mo’,’teli’,’tim-‘,
‘tosh’,’tsm-‘,’upg1′,’upsi’,’vk-v’,’voda’,’wap-‘,’wapa’,’wapi’,’wapp’,
‘wapr’,’webc’,’winw’,’winw’,’xda’,’xda-‘);

if(in_array($mobile_ua,$mobile_agents)){
$mobile_browser++;
}
if (strpos(strtolower($_SERVER[‘ALL_HTTP’]),’OperaMini’)>0) {
$mobile_browser++;
}
if (strpos(strtolower($_SERVER[‘HTTP_USER_AGENT’]),’windows’)>0) {
$mobile_browser=0;

}

//change this to your mobile friendly page
if($mobile_browser>0){
header( “Location: http://www.yourwebsite.com/mobile/” ) ;
} else {
// do something else
}

$ua = $HTTP_USER_AGENT;
if (stristr($ua, “Windows CE”) or stristr($ua, “AvantGo”) or stristr($ua,
“Mazingo”) or stristr($ua, “Mobile”) or stristr($ua, “T68”) or stristr($ua,
“Syncalot”) or stristr($ua, “Blazer”) or stristr($ua, “NetFront”))
{
$DEVICE_TYPE=”MOBILE”;
}

if (isset($DEVICE_TYPE) and $DEVICE_TYPE==”MOBILE”)
{
//change this to your mobile friendly page
header( “Location: http://www.yourwebsite.com/mobile/” ) ;
exit;
}

?>

Added Pizza Builder to Online Ordering Application

A new feature has been implemented into the pizza builder application, you can now build your own pizza using the new feature. This process has been simplified for ease of use. The pizza builder application is completely configurable in the administration section of the website. The admin section allows you to add different types of pizza, assign sizes, names, prices, toppings and topping prices. This feature also gives the pizza owner complete details of what the customer ordered.

To view a demo of the pizza builder click here

Online food ordering script “Restaurant Biller” released with pricing!

rest.png

  • Easy AJAX powered checkout system
  • Receive the orders directly through email within 30 seconds of placed order
  • Easy customization for those who want to modify their site
  • Set the hours you would like your store open
  • Turn your store off and on through the administration panel
  • Enable Credit or disable credit cards
  • Enable or disable delivery and delivery fees
  • Modify your home page directly from a control panel
  • Add Edit and delete categories to your menu
  • Add Edit and delete menu items with extented features
  • Each site has a contact us page for customer questions
  • Edit the hours you would like your online store open
  • Add an addition cost for delivery, tax prices or order processing fees
  • Built In newsletter system
  • Free updates

Click here for a demo

Cubecart Mass (bulk) price changer

This module will change the product prices of all products or the categories you select. You can pick add/subtract and choose if you would like to use addition/subtraction or percentage.

Features

  • Add or subtract an amount or percentage
  • Preview the changes before making any changes
  • Choose all products
  • Choose just a certain category
  • Complete product price updates painlessly and quick!

capture.JPG
Price: $10
/