<?php

renew_session();
//Manager variables
$alert_msg = '';
$manager_title = '';
$user = get_user_byNAME($_SESSION['CLIENT']);
$status = 'APPROVED';
if (isset($_POST['adminreply'])) {
    if (submit_comment($_POST) !== false) {
        $alert_msg = '<div class="success-msg">Your comment has been posted.<p></p></div>';
    } else {
        $alert_msg = '<div class="warning-msg">An error occurred, your comment has not been posted.<p></p></div>';
    }
}
if (isset($_GET) && isset($_GET['action'])) {
    switch ($_GET['action']) {
        case 'allcomments':
        case 'adminreplied':
            //Manager variables
            $manager_title = 'Approved Comments';
            //Comments variables
            $status = 'APPROVED';
            break;
        case 'pendingcomments':
            //Manager variables
            $manager_title = 'Pending Comments';
            //Comments variables
            $status = 'PENDING';
            break;
        case 'deletecomment':
Beispiel #2
0
<?php

require_once 'config/tank_config.php';
$getjson = file_get_contents('php://input');
$dataarr = json_decode($getjson, true);
$token = $dataarr['token'];
$pid = $dataarr['pid'];
$poster = $dataarr['uid'];
$type = $dataarr['type'];
$text = $dataarr['text'];
$taskid = $dataarr['taskid'];
$date = $dataarr['date'];
$uid = check_token($token);
if ($uid != 3) {
    $get_function = submit_comment($text, $poster, $pid, $type, $date, $taskid);
    $redata = json_encode($get_function);
    echo $redata;
} else {
    echo 3;
}
<?php

require_once "../includes/session.php";
require_once "../includes/db_connection.php";
require_once "../includes/functions.php";
if (isset($_POST["submit"])) {
    // insert comment into comments
    $success = submit_comment($_POST["user_id"], $_POST["episode_id"], $_POST["comment"]);
    if ($success) {
        $comment_id = mysqli_insert_id($connection);
        init_comment_votes($comment_id);
        echo make_comment_from_id($comment_id);
    } else {
        echo "Comment submission failed.";
    }
}