function saveData($type = 'visit') { global $mysqli; $ua = determineBrowser(); $ipaddress = getIP(); $sessionid = session_id(); //$time=new Zend_Db_Expr($db->quoteInto("FROM_UNIXTIME(?,'%Y-%m-%d %H:%i:%s')", time())); //$time=new Zend_Db_Expr($db->quoteInto("FROM_UNIXTIME(?)", time())); $data = array('openid' => null, 'position' => 'home', 'action' => $type, 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'browser' => $ua[0], 'browser_version' => $ua[1], 'mobile' => getDeviceType(), 'platform' => getDeviceType(true), 'date_add' => 'now()'); $sql = 'insert into ' . TABLE_PREFIX . 'data (`position`,`session_id`,`action`,`ip_address`,`user_agent`,`browser`,`browser_version`,`mobile`,`platform`) values(\'' . $data['position'] . '\',\'' . $sessionid . '\',\'' . $data['action'] . '\',\'' . $ipaddress . '\',\'' . $data['user_agent'] . '\',\'' . $data['browser'] . '\',\'' . $data['browser_version'] . '\',\'' . $data['mobile'] . '\',\'' . $data['platform'] . '\')'; //echo $sql; $mysqli->query($sql); $id = $mysqli->insert_id; //$mysqli->close(); return $id; }
<td><small><?php echo stripslashes($row["vehicle_no"]); ?> <input type="hidden" name="vehicle_id" id="vehicle_id" value="<?php echo stripslashes($row["Vehicle_id"]); ?> "> <input type="hidden" name="custid" id="custid" value="<?php echo stripslashes($row["cust_id"]); ?> "> </small> </td> <td><small><?php echo getDeviceType($row['device_type']); ?> </small></td> <td><small><?php if ($row['device_amt'] != 0) { echo getDeviceAmt($row['device_amt']); } else { echo 'N/A'; } ?> </small></td> <td><small><?php if ($row['device_rent_amt'] != 0) { echo getDeviceAmt($row['device_rent_amt']); } else { echo 'N/A';
// get what page is requested if (isset($_GET['q'])) { $url = $_GET['q']; if ($url == null || count($url) < 1) { $url = '/'; } } else { $url = '/'; } return $url; } /* main ########## */ $page = getURL(); if (!array_key_exists($page, $pages)) { // invalid URL header('HTTP/1.0 404 Not Found', true, '404'); exit; } $to_show = $pages[$page]; if (is_callable($to_show)) { call_user_func($to_show); exit; } else { $device = getDeviceType(); if (!array_key_exists($device, $to_show)) { header('HTTP/1.0 500 Internal Server Error', true, '500'); exit; } call_user_func($to_show[$device]); exit; }