Esempio n. 1
0
 public function testSuppressionFichier()
 {
     echo "Init Test Delete File \n";
     $champs = "51::;;::utilisateur::;;::Nom de la tache::;;::01/01/2000::;;::27/07/2333::;;::Sa description\n";
     insertionFichier(23330727, "{$champs}", "task.txt");
     $val = suppressionTask(-51, 0, "task.txt");
     $this->assertEquals($val, false);
     $val2 = suppressionTask(51, 0, "task.txt");
     $this->assertEquals($val2, true);
     echo "Finished Test Delete File \n";
 }
Esempio n. 2
0
controleSession();
include_once controleLang();
//If we are not indetified and we are trying to access to this page, we are directed rerouted to the homepage
if (!isset($_SESSION['id'])) {
    header("Location:accueil.php");
}
if (isset($_GET['lang'])) {
    $_SESSION['lang'] = $_GET['lang'];
    setcookie('lang', $_SESSION['lang']);
}
//We read all the inputs modified and, task's ID and the user's ID.
if (isset($_POST['nomTask']) && isset($_POST['debut']) && isset($_POST['fin']) && isset($_POST['description']) && isset($_POST['val0']) && isset($_POST['val1'])) {
    //To modify a task, we delete the old one and create a new.
    $task[0] = $_POST['val0'];
    $task[1] = $_POST['val1'];
    suppressionTask($task[0], 0, "task.txt");
    creationTask($task, $_POST['nomTask'], $_POST['debut'], $_POST['fin'], $_POST['description']);
}
//If the page is entered wthout the value "lodif", the user is rerouted to the homepage
if (!isset($_GET['action']) || !isset($_GET['value'])) {
    header("Location:accueil.php");
} else {
    //We get value witch is the user's ID. This value will be used by the function mocifierTask to check if the user is allowed to modify this task
    if (isset($_GET['action']) && $_GET['action'] == 'modif' && isset($_GET['value'])) {
        $task = modifierTask($_GET['value']);
    } else {
        //If not, he's rerouted.
        header("Location:accueil.php");
    }
}
?>
Esempio n. 3
0
if (isset($_GET['action']) && $_GET['action'] == 'deco') {
    setcookie('id', $_SESSION['id']);
    //Before deconnecting, we recover the cookie for the next connection
    deconnexion();
    return;
}
//When someone wants to change the language, we change it and we save it in a cookie for the next connection
if (isset($_GET['lang'])) {
    $_SESSION['lang'] = $_GET['lang'];
    setcookie('lang', $_SESSION['lang']);
}
//When someone wants to delete a taks, we check if we recieve the identifier "value" of the task
if (isset($_GET['action']) && $_GET['action'] == 'supr' && isset($_GET['value'])) {
    //Then we check if the user is authorized to delete this task
    if (strcmp($_SESSION['id'], "david") == 0 || strcmp($_SESSION['id'], $_GET['user']) == 0) {
        suppressionTask($_GET['value'], 1);
    } else {
        echo "Vous n'etes pas autorise a supprimer cette tache (petit coquin)";
    }
    //If not, we print an error message
    return;
}
//We call controleLang to print the dashboard in the correct language
include_once controleLang();
$selected = "accueil";
?>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />