$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); echo $tours->getIntervale($guard_id); } else { echo "You are not registered!"; } } // function saveImage($base64img, $extension){ // define('UPLOAD_DIR', 'uploads/'); // $base64img = str_replace('data:image/'.$extension.';base64,', '', $base64img); // $data = base64_decode($base64img); // $file = UPLOAD_DIR . $date.'.'.$extension; // file_put_contents($file, $data); // } function base64_encode_image($filename = string, $filetype = string) { if ($filename) {