Example #1
0
 }
 $date = $form->securite_bdd(strip_tags($_POST['date_tour']));
 $heure = $form->securite_bdd(strip_tags($_POST['heure']));
 $qrcode = $form->securite_bdd(strip_tags($_POST['qrcode']));
 $description = $form->securite_bdd(strip_tags($_POST['description']));
 $uid = $form->securite_bdd(strip_tags($_POST['uid']));
 // echo htmlspecialchars("363663_3737373.jpeg");
 // echo $form->securite_bdd(strip_tags("363663_3737373.jpeg"));
 // $date = "2016-03-02";
 // $heure = "08:09:01";
 // $photo = base64_encode_image("img/hqdefault.jpg", "jpeg");
 // $qrcode = "5364564538837830";
 // $matricule = "1234";
 // $description = "je sais pas";
 // $uid = "mlkmlmlml";
 $guard_id = $model->dynamicSelect("guard", "uid = ?", array($uid), "id")['id'];
 $guard_tours_id = $model->dynamicSelect("guardtours", "guard_id = ?", array($guard_id), "id")['id'];
 $mention = $tours->getMention($heure, $guard_tours_id);
 if (!is_null($mention)) {
     $date_temp = $date;
     $heure_temp = $heure;
     $chars = array(".", ":", "/", "-", " ");
     $date_temp = str_replace($chars, "", $date_temp);
     $heure_temp = str_replace($chars, "", $heure_temp);
     $path = null;
     if (!is_null($photo)) {
         $path = 'uploads/' . $matricule . '_' . $date_temp . '' . $heure_temp . '.jpeg';
     }
     $new_POST = array('date_tour' => $date, 'qrcode' => $qrcode, 'description' => $description, 'heure' => $heure, 'mention' => $mention, 'matricule' => $matricule, 'photo' => $path, 'guardtours_id' => $guard_tours_id);
     $form->register("tours", $new_POST);
     $form->saveImage($photo, 'jpeg', $path);
Example #2
0
 public static function validation($post)
 {
     $message = array('uid' => '', 'nif' => '', 'phone' => '', 'error' => 0);
     $model = new Model();
     $uid = $model->dynamicSelect("guard", "uid = ?", array($post['uid']), "id");
     $nif = $model->dynamicSelect("guard", "nif = ?", array($post['nif']), "id");
     $phone = $model->dynamicSelect("guard", "phone = ?", array($post['phone']), "id");
     if (!empty($uid)) {
         $message['uid'] = 'A guard with this uid already exist!';
         $message['error'] = 1;
     } elseif (!empty($phone)) {
         $message['phone'] = 'A guard with this phone number already exist!';
         $message['error'] = 1;
     } elseif (!empty($nif)) {
         $message['nif'] = 'A guard with this nif already exist!';
         $message['error'] = 1;
     }
     return $message;
 }
Example #3
0
 public function getIntervale($id)
 {
     $model = new Model();
     $intervale = $model->dynamicSelect("guardtours", "guard_id = ?", array($id), "intervale")['intervale'];
     // $intervale = "00:03:00";
     return intval(strtotime($intervale) - strtotime("00:00:00") - $this->result * 3600) * 1000;
 }