Example #1
0
         log_out(1);
     }
     break;
 case "moderation":
     $treat_post = false;
     moderate_post();
     header('Location:index.php?action=display_post');
     break;
 case "anonymization":
     $treat_post = false;
     change_post_confidentiality_status();
     header('Location:index.php?action=display_post');
     break;
 case "vote_post":
     $treat_post = false;
     vote_post();
     header('Location:index.php?action=display_post');
     break;
 case "vote_comment":
     $treat_post = false;
     vote_comment();
     if (!empty($balise)) {
         header('Location:index.php?action=display_post' . (isset($_GET['unique']) ? '&unique=' . $_GET['unique'] : '') . '#' . $balise);
     } else {
         header('Location:index.php?action=display_post' . (isset($_GET['unique']) ? '&unique=' . $_GET['unique'] : ''));
     }
     break;
 case "accept_cgu":
     $treat_post = false;
     $_SESSION['confirmation_agreement'] = "ok";
     header('Location:index.php?action=display_docu');
Example #2
0
<?php

session_start();
include "../config.php";
include "../functions.php";
include "../private_functions.php";
if (isset($_SESSION['auth']) && $_SESSION['auth'] == 1 && isset($_GET['pID'])) {
    $dbh = db_connect($MY_HOST, $MY_DB_PORT, $MY_DB, $DB_USER, $DB_PW);
    if (already_voted($dbh, $_SESSION['user'], $_GET['pID'])) {
        echo json_encode(array("status" => -2));
    } else {
        $res = vote_post($dbh, $_SESSION['user'], $_GET['pID']);
        close_db_connection($dbh);
        echo json_encode($res);
    }
} else {
    echo json_encode(array("status" => -1));
}