Пример #1
0
session_start();
// On démarre la session AVANT toute chose
if (isset($_SESSION["ip"])) {
    $user_ip = $_SESSION["ip"];
}
if (isset($_SESSION["user_mail"])) {
    $user_mail = $_SESSION["user_mail"];
}
if (isset($_POST['vote']) and isset($_POST['vote_id']) and isset($_POST['vote_type'])) {
    $vote = $_POST['vote'];
    $vote_id = $_POST['vote_id'];
    $vote_type = $_POST['vote_type'];
    $messageUpdate = "Erreur technique lors de la mise à jour de la donnée.";
    if ($vote_type == "arg") {
        //			$logClass->setNewLog($vote." ".$vote_id." ".$vote_type,$user_ip);
        $args = $argClass->getArgById($vote_id);
        $arg_id = $args[0]->arg_id;
        $debat_id = $args[0]->debat_id;
        $arg_rank = $args[0]->arg_rank;
        $arg_type = $args[0]->arg_type;
        $arg_link_id = $args[0]->arg_link_id;
        $arg_lib_fr = $args[0]->arg_lib_fr;
        //			$arg_lib_fr = htmlentities($arg_lib_fr,ENT_QUOTES); //Convertit tous les caractères éligibles en entités HTML.
        //			$logClass->setNewLog($arg_id." ".$arg_rank." ".$arg_type." ".$arg_link_id." ".$arg_lib_fr, $user_ip);
        if (isset($args) and $vote == "plus") {
            //vote + pour un argument
            $nb = $argClass->setArgByIdForRank($arg_id, intval($arg_rank) + 1);
            //ajouter le * user_rank
            $user_histoClass->setUser_histo($user_mail, $debat_id, $arg_id, $vote_type . $vote, $user_ip);
            $_SESSION['message'] = htmlentities("Vote + pour l'argument enregistré");
        } else {