Example #1
0
<?php

require_once '../includes/initialize.php';
?>


<?php 
confirm_logged_in();
?>

<?php 
$course = find_course_by_id($_GET['id']);
if (!$course) {
    // admin ID was missing or invalid or
    // admin couldn't be found in database
    redirect_to("admin.php");
}
$today = date("Y-m-d");
$todaytime = date("Y-m-d H:i:s");
$year = (int) date("Y");
$month = date("M");
?>

<?php 
if (isset($_POST['submit'])) {
    $required_fields = array("DateCourse", "Chauffeur", "Heure", "AllerRetour", "Pseudo", "Depart", "Arrivee");
    validate_presences($required_fields);
    $chauffeur = mysql_prep($_POST["Chauffeur"]);
    $pseudo = mysql_prep($_POST["Pseudo"]);
    $pseudo_autres = mysql_prep($_POST["name"]);
    $nom_patient = mysql_prep($_POST["Nom_Patient"]);
Example #2
0
<?php

require_once '../includes/initialize.php';
confirm_logged_in();
?>

<?php 
if (!isset($_GET["id"])) {
    redirect_to("admin.php");
}
$course = find_course_by_id($_GET["id"]);
if (!$course) {
    // admin ID was missing or invalid or
    // admin couldn't be found in database
    $_SESSION["message"] = "Course does not exist in course database.";
    redirect_to("admin.php");
}
if (is_chauffeur()) {
    $_SESSION["message"] = "Chauffeur cannot validate only manager can.";
    redirect_to("admin.php");
}
// TODO some checking to validation and book course retour
if ($course['validated'] == 1) {
    $_SESSION["message"] = "Course cannot be deleted. It was  already validated by a manager.";
    redirect_to("admin.php");
}
$id = $course["id"];
$query = "UPDATE courses SET ";
$query .= "validated = 1 ";
$query .= "WHERE id = {$id} ";
$query .= "LIMIT 1";