public function forgotPassword($email)
 {
     //var_dump($email);exit();
     $query = CLS_MYSQL::Query("SELECT user_name,user_mail FROM users WHERE user_mail='{$email}'");
     //echo "SELECT user_name,user_mail FROM users WHERE user_mail='$email'";
     //var_dump($query);exit();
     $count = CLS_MYSQL::GetResultNumber($query);
     if ($count == 0) {
         $data = "Email does not exist";
         $this->display($data);
     } else {
         $user_name = CLS_MYSQL::GetResultValue($query, 0, 'user_name');
         $string = $this->random_string();
         //var_dump($string);
         //var_dump($rand);
         //echo sha1($string);
         //echo "9011d6581a45b82e5f559063c4aa6d367e5c3ac5";
         //var_dump(sha1($string));exit();
         $this->resetPasscode($string, $email);
         //exit();
         $Email = new VTSMail();
         $Email->setName($user_name);
         //To name
         $Email->setMail($email);
         //To e-mail
         $Email->setSubject("Registration");
         //Subject
         $Email->setMessage("Password Reset Successful\n Your Passcode:{$string}");
         $Email->sendMail();
         $this->display('Password reset successful');
     }
 }
Exemplo n.º 2
0
 public function getFullGmtData($split)
 {
     $query = CLS_MYSQL::Query("SELECT * FROM gmt_zones");
     $count = CLS_MYSQL::GetResultNumber($query);
     //echo"<pre>";
     //var_dump($query);
     for ($i = 0; $i < $count; $i++) {
         $data['Result']['Data'][$i]['gmt_id'] = CLS_MYSQL::GetResultValue($query, $i, 'id');
         $data['Result']['Data'][$i]['gmt'] = CLS_MYSQL::GetResultValue($query, $i, 'gmt');
         $data['Result']['Data'][$i]['secondsDiff'] = CLS_MYSQL::GetResultValue($query, $i, 'secondsDiff');
         //$data['Result']['Data'][$i]['Location']=CLS_MYSQL::GetResultValue($query,$i,'Location');
         //print_r($location);
         //$spl=preg_split('/(,(?: ))/', $location);
         $location = CLS_MYSQL::GetResultValue($query, $i, 'Location');
         /*if($split==1)
         		{
         		$data['Result']['Data'][$i]['Location']=preg_split('/(,(?: ))/', $location);
         		}
         		else
         		{
         		$data['Result']['Data'][$i]['Location']=$location;
         		}*/
         $data['Result']['Data'][$i]['Location'] = $split == 1 ? preg_split('/(,(?: ))/', $location) : $location;
         //print_r($spl);
         //exit();
     }
     $this->display($data);
 }
Exemplo n.º 3
0
 public function fetchFaq()
 {
     $query = CLS_MYSQL::Query("SELECT * FROM faq");
     $count = CLS_MYSQL::GetResultNumber($query);
     for ($i = 0; $i < $count; $i++) {
         $dataDB['Result']['Data'][$i]['Faq'] = CLS_MYSQL::GetResultValue($query, $i, 'faq');
     }
     $this->display($dataDB);
 }
Exemplo n.º 4
0
 public function getFullApnData()
 {
     $query = CLS_MYSQL::Query("SELECT * FROM apn_settings");
     $count = CLS_MYSQL::GetResultNumber($query);
     //echo"<pre>";
     //var_dump($query);
     for ($i = 0; $i < $count; $i++) {
         $data['Result']['Data'][$i]['apn_id'] = CLS_MYSQL::GetResultValue($query, $i, 'id');
         $data['Result']['Data'][$i]['apn_settings'] = CLS_MYSQL::GetResultValue($query, $i, 'apn_settings');
         $data['Result']['Data'][$i]['network'] = CLS_MYSQL::GetResultValue($query, $i, 'network');
         $data['Result']['Data'][$i]['country'] = CLS_MYSQL::GetResultValue($query, $i, 'country');
     }
     $this->display($data);
 }
 function vehicleDetails($user_id)
 {
     $query = CLS_MYSQL::Query("SELECT * FROM user_devices WHERE user_id='{$user_id}'");
     $count = CLS_MYSQL::GetResultNumber($query);
     if ($count == 0) {
         $dataDB['Result']['Data'][0]['Status'] = "no vehicle";
     } else {
         for ($i = 0; $i < $count; $i++) {
             $dataDB['Result']['Data'][$i]['uid'] = CLS_MYSQL::GetResultValue($query, $i, 'uid');
             $dataDB['Result']['Data'][$i]['alias'] = CLS_MYSQL::GetResultValue($query, $i, 'alias');
         }
     }
     $this->display($dataDB);
 }
 function getDevices($id)
 {
     $query = CLS_MYSQL::Query("SELECT b. *\r\nFROM users AS a\r\nLEFT JOIN user_devices AS b ON a.user_id = b.user_id\r\nWHERE a.user_id = '{$id}'");
     $count = CLS_MYSQL::GetResultNumber($query);
     for ($i = 0; $i < $count; $i++) {
         $dataDB['Result']['Data'][$i]['device_id'] = CLS_MYSQL::GetResultValue($query, $i, 'id');
         $dataDB['Result']['Data'][$i]['mobile_num'] = CLS_MYSQL::GetResultValue($query, $i, 'mobile');
         //$dataDB['Result']['Data'][$i]['offset']=CLS_MYSQL::GetResultValue($query,$i,'offset');
         $dataDB['Result']['Data'][$i]['imei'] = CLS_MYSQL::GetResultValue($query, $i, 'imei');
         $dataDB['Result']['Data'][$i]['alias'] = CLS_MYSQL::GetResultValue($query, $i, 'alias');
     }
     //$dataDB['Result']['id']=session_id();
     $dataDB['Result']['user_id'] = $id;
     $dataDB['Result']['Status'] = "Successfully logged in";
     $this->display($dataDB);
 }
 function logDetails($date1, $time1, $date2, $time2, $imei)
 {
     //$uid='12';
     $Timestamp1 = $this->makeTimestamp($date1, $time1);
     $Timestamp2 = $this->makeTimestamp($date2, $time2);
     $query = CLS_MYSQL::Query("SELECT * FROM track_data where activity BETWEEN '{$Timestamp1}' AND '{$Timestamp2}' AND imei='{$imei}'");
     $count = CLS_MYSQL::GetResultNumber($query);
     //echo $count;
     if ($count == 0) {
         $dataDB['Result']['Data'][0]['Status'] = "No data";
     } else {
         for ($i = 0; $i < $count; $i++) {
             //$dataDB['Result']['Data'][$i]['uid'] = CLS_MYSQL::GetResultValue($this->query,$i,'uid');
             $latitude[$i] = CLS_MYSQL::GetResultValue($query, $i, 'latitude');
             $longitude[$i] = CLS_MYSQL::GetResultValue($query, $i, 'longitude');
             // $dataDB['Result']['Data'][$i]['date_time'] = CLS_MYSQL::GetResultValue($query,$i,'date_time');
         }
     }
     //var_dump($latitude);
     $this->traceRoute($latitude, $longitude, $count);
 }
 function currentLocation($imei)
 {
     //var_dump($imei);
     $delay = 19800;
     $query = CLS_MYSQL::Query("SELECT latitude,longitude,activity,velocity FROM track_data WHERE imei='{$imei}' ORDER BY activity DESC LIMIT 1");
     //var_dump($query);
     $count = CLS_MYSQL::GetResultNumber($query);
     //echo $count;
     if ($count == 0) {
         $dataDB['Result']['Data'][0]['Status'] = "No data";
     } else {
         //imei 	latitude 	longitude 	activity 	velocity
         for ($i = 0; $i < $count; $i++) {
             $data['result'][$i]['latitude'] = CLS_MYSQL::GetResultValue($query, 0, 'latitude');
             $data['result'][$i]['longitude'] = CLS_MYSQL::GetResultValue($query, 0, 'longitude');
             //$geo_status = CLS_MYSQL::GetResultValue($query,0,'geo_status');
             //$out_range = CLS_MYSQL::GetResultValue($query,0,'out_range');
             //$read_status = CLS_MYSQL::GetResultValue($query,0,'read_status');
             //$alias = CLS_MYSQL::GetResultValue($query,0,'alias');
             //$range = CLS_MYSQL::GetResultValue($query,0,'range');
             $data['result'][$i]['velocity'] = CLS_MYSQL::GetResultValue($query, 0, 'velocity');
             $current = $delay + CLS_MYSQL::GetResultValue($query, 0, 'activity');
             $data['result'][$i]['last_update'] = date("D-M-Y H:i:s", $current);
         }
     }
     //$this->traceRoute($latitude,$longitude,$count);
     if ($data == '') {
         $data['result'][0]['status'] = "No data";
         $this->display($data);
     }
     $this->display($data);
 }
 public function setUserRegistration($user_id)
 {
     if (!$this->databaseUsersTable) {
         $this->getMessage('contact nuthan', '', '', 'true');
     }
     $imei = $_REQUEST['imei'];
     //var_dump($imei);
     $admin_mob = $_REQUEST['admin_mob'];
     $apn = $_REQUEST['apn'];
     $mobile = $_REQUEST['mobile'];
     $offset = $_REQUEST['offset'];
     $alias = $_REQUEST['alias'];
     $this->checkFields($imei, $mobile, $offset, $alias, $admin_mob, $apn);
     //$user_id=$_SESSION['user_id'];
     //$user_confirm_pass=$_POST['user_confirm_pass'];
     // $user_mail=$_REQUEST['user_mail'];
     // $user_confirm_mail=$_POST['user_confirm_mail'];
     // $user_crypted_pass=$this->setCrypt($user_pass);
     $query = CLS_MYSQL::Query("SELECT * FROM user_devices WHERE imei='{$imei}'");
     $count = CLS_MYSQL::GetResultNumber($query);
     // $result_user_mail=CLS_MYSQL::Query("SELECT * FROM"." ".$this->databaseUsersTable." "."WHERE user_mail='$user_mail'");
     $count = CLS_MYSQL::GetResultNumber($query);
     //var_dump($count);
     //$imei=CLS_MYSQL::GetResultValue($query,0,'imei');
     //$uid==CLS_MYSQL::GetResultValue($query,0,'uid');
     //var_dump($uid)
     if ($count == 1) {
         $this->display('device id already exist');
     } else {
         $query = CLS_MYSQL::Query("SELECT * FROM users WHERE user_id='{$user_id}'");
         $user_name = CLS_MYSQL::GetResultValue($query, 0, 'user_name');
         $user_mail = CLS_MYSQL::GetResultValue($query, 0, 'user_mail');
         $user_pass = CLS_MYSQL::GetResultValue($query, 0, 'user_pass');
         if (CLS_MYSQL::Execute("INSERT INTO user_devices (user_id, mobile, offset, imei, alias) VALUES ('{$user_id}','{$mobile}','{$offset}','{$imei}','{$alias}')")) {
             $Email = new VTSMail();
         }
         $Email->setName($user_name);
         //To name
         $Email->setMail($user_mail);
         //To e-mail
         $Email->setSubject("VTS Registration");
         //Subject
         $Email->setMessage("VTS Registration for Device IMEI:{$imei}");
         $Email->sendMail();
         //var_dump($Email);
         $this->display('Registration was successful');
     }
 }
Exemplo n.º 10
0
 function getDeviceList($user_id)
 {
     //var_dump($user_id);
     $query = CLS_MYSQL::Query("SELECT id FROM user_devices WHERE user_id='{$user_id}'");
     $count = CLS_MYSQL::GetResultNumber($query);
     //echo $count;
     for ($i = 0; $i < $count; $i++) {
         $devices[$i] = CLS_MYSQL::GetResultValue($query, $i, 'id');
     }
     //print_r($uids);
     return $devices;
     //print_r($uid);
 }
 /**
  * Defines the class variable required for conversion
  * Dont call this function. It is used internally
  */
 private function setZoneSecDiff()
 {
     if (empty($this->zoneId)) {
         $this->zoneSecDiff = 0;
         return;
     }
     $query = CLS_MYSQL::Query('SELECT secondsDiff FROM gmt_zones WHERE id = ' . $this->zoneId);
     //if(!$this->dbH)
     //$this->connectDB();
     //$recordSet 			= mysql_query($query, $this->dbH);
     $recordSet = CLS_MYSQL::GetResultNumber($query);
     if ($recordSet != 1) {
         die('Error : Invalid zone id');
     }
     //$this->zoneSecDiff	= mysql_result($recordSet, 0);
     $this->zoneSecDiff = CLS_MYSQL::GetResultValue($recordSet, 0, 'secondsDiff');
 }
 public function verifyPasscode($passcode, $user_id)
 {
     $query = CLS_MYSQL::Query("SELECT user_name FROM users WHERE user_active='{$passcode}' and user_id='{$user_id}'");
     $count = CLS_MYSQL::GetResultNumber($query);
     return $count;
 }
 function logDetails($date1, $time1, $date2, $time2, $uid)
 {
     $Timestamp1 = $this->makeTimestamp($date1, $time1);
     //echo $Timestamp1;echo "<br/>";
     $Timestamp2 = $this->makeTimestamp($date2, $time2);
     //echo $Timestamp2;echo "<br/>";
     $this->query = CLS_MYSQL::Query("SELECT gid,uid, latitude, longitude,FROM_UNIXTIME(UTC) AS date_time FROM gprs where UTC BETWEEN '{$Timestamp1}' AND '{$Timestamp2}' AND uid='12'");
     //08-07-2011&time1=06:01:07
     //echo mktime(06,01,07,07,08,2011);
     //echo date("Y-m-d H:i:s",1310130067);
     $a = "SELECT gid,uid, latitude, longitude,FROM_UNIXTIME(UTC) AS date_time FROM gprs where UTC BETWEEN '{$Timestamp1}' AND '{$Timestamp2}' AND uid='12'";
     //echo $a;
     $this->count = CLS_MYSQL::GetResultNumber($this->query);
     if ($this->count == 0) {
         $dataDB['Result']['Data'][0]['Status'] = "No data";
     } else {
         for ($i = 0; $i < $this->count; $i++) {
             // $dataDB['Result']['Data'][$i]['gid'] = CLS_MYSQL::GetResultValue($this->query,$i,'gid');
             // $dataDB['Result']['Data'][$i]['uid'] = CLS_MYSQL::GetResultValue($this->query,$i,'uid');
             $dataDB['Result']['Data'][$i]['latitude'] = CLS_MYSQL::GetResultValue($this->query, $i, 'latitude');
             $dataDB['Result']['Data'][$i]['longitude'] = CLS_MYSQL::GetResultValue($this->query, $i, 'longitude');
             $dataDB['Result']['Data'][$i]['date_time'] = CLS_MYSQL::GetResultValue($this->query, $i, 'date_time');
         }
     }
     $this->display($dataDB);
 }
 function geoFencing($device_id, $out_range, $range)
 {
     //$query=CLS_MYSQL::Query("SELECT range,out_range FROM user_devices WHERE uid='$uid'");
     //$range=CLS_MYSQL::GetResultValue($query,0,'range');
     //$out_range=CLS_MYSQL::GetResultValue($query,0,'out_range');
     //var_dump($out_range);
     if ($out_range != 0) {
         $query = CLS_MYSQL::Query("SELECT out_range\n\t\t\t\tFROM user_devices WHERE id = '{$device_id}'");
         $count = CLS_MYSQL::GetResultNumber($query);
         if ($count == 0) {
             $dataDB['Result']['Data'][0]['Status'] = "no data";
         } else {
             for ($i = 0; $i < $count; $i++) {
                 //$dataDB[$i]['lat_ref']=CLS_MYSQL::GetResultValue($query,0,'lat_ref');
                 //$dataDB[$i]['long_ref']=CLS_MYSQL::GetResultValue($query,0,'long_ref');
                 //$dataDB[$i]['lat_set']=CLS_MYSQL::GetResultValue($query,0,'lat_set');
                 //$dataDB[$i]['long_set']=CLS_MYSQL::GetResultValue($query,0,'long_set');
                 //$dataDB[$i]['preset_range']=CLS_MYSQL::GetResultValue($query,0,'range');
                 $dataDB['out_range'] = CLS_MYSQL::GetResultValue($query, 0, 'out_range');
             }
         }
         return $dataDB;
         //$this->display($dataDB);
     }
     //return '';
 }
 function logDetails($date1, $time1, $date2, $time2, $id)
 {
     //$uid='12';
     $delay = $this->localTime($id);
     //$delay=19800;
     $Timestamp1 = $this->makeTimestamp($date1, $time1);
     $Timestamp2 = $this->makeTimestamp($date2, $time2);
     $Timestamp1 = $Timestamp1 + $delay;
     $Timestamp2 = $Timestamp2 + $delay;
     $query = CLS_MYSQL::Query("SELECT * FROM track_data where activity BETWEEN '{$Timestamp1}' AND '{$Timestamp2}' AND device_id='{$id}'");
     //echo "SELECT * FROM track_data where activity BETWEEN '$Timestamp1' AND '$Timestamp2' AND device_id='$id'";
     //exit();
     $count = CLS_MYSQL::GetResultNumber($query);
     //echo $count;
     if ($count == 0) {
         $dataDB['Result']['Data'][0]['Status'] = "No data";
         //	echo "alert('No history');</script>";
         echo "jAlert('No history', 'Alert');</script>";
         exit;
     } else {
         for ($i = 0; $i < $count; $i++) {
             //$dataDB['Result']['Data'][$i]['uid'] = CLS_MYSQL::GetResultValue($this->query,$i,'uid');
             $latitude[$i] = CLS_MYSQL::GetResultValue($query, $i, 'latitude');
             $longitude[$i] = CLS_MYSQL::GetResultValue($query, $i, 'longitude');
             // $dataDB['Result']['Data'][$i]['date_time'] = CLS_MYSQL::GetResultValue($query,$i,'date_time');
         }
     }
     //var_dump($latitude);
     $this->traceRoute($latitude, $longitude, $count);
 }