示例#1
0
$newsId = -1;
if (isset($_GET['news'])) {
    $newsId = intval($_GET['news']);
}
$commentId = -1;
if (isset($_GET['comment'])) {
    $commentId = intval($_GET['comment']);
}
$currentNews = getNewsData($newsId);
if (isset($_POST['submit'])) {
    $postNewsId = intval($_POST['newsId']);
    $postCommentId = intval($_POST['commentId']);
    if ($postCommentId == -1) {
        sendComments($postNewsId, $_POST['userComment']);
    } else {
        updateComment($postCommentId, $_POST['userComment']);
    }
    header("Location: comments.php?news={$postNewsId}");
    exit;
}
if (isset($_POST['delete'])) {
    $postCommentId = intval($_POST['commentId']);
    deleteComment($postCommentId);
}
?>

<script>
    
    function deleteComment(newsId, commentId)
    {
        $.post
            //Get Request From Device
            $commentId = $rm->cleanData($_POST['commentId']);
            $getArrayList = array();
            //echo $ENCRYPTEDPWD = md5($PASSWORD);
            //echo $ENCRYPTEDPWD = base64_decode($PASSWORD);
            //$ENCRYPTEDPWD=$PASSWORD;
            if ($comment == "" || $commentId == "") {
                $result = $rm->fields_validation();
                return $result;
            } else {
                $getInsertFieldValue['comment_text_f'] = $comment;
                $affectedRowsUpdateComment = $rm->update_record($getInsertFieldValue, 'comments_t', 'comment_id', $commentId);
                if ($affectedRowsUpdateComment > 0) {
                    $result = $rm->updateCommentSuccessJson($commentId);
                    return $result;
                } else {
                    $result = $rm->updateCommentFailJson();
                    return $result;
                }
            }
        } else {
            $result = $rm->ssl_error();
            return $result;
        }
    } else {
        $result = $rm->ssl_error();
        return $result;
    }
}
echo updateComment();
示例#3
0
    header("Location: login.php");
}
$send_tekst = "";
$send_tekst_error = "";
// *********************
if (isset($_POST["salvesta"])) {
    if (empty($_POST["send_tekst"])) {
        $send_tekst_error = "See väli on kohustuslik";
    } else {
        $send_tekst = cleanInput($_POST["send_tekst"]);
    }
    if ($send_tekst_error == "") {
        echo $send_tekst;
        // functions.php failis käivina funktsiooni
        // msq on message funktsioonist mis tagasi saadame
        $msg = updateComment($send_tekst);
        if ($msg != "") {
            //salvestamine õnnestus
            // teen tühjaks input value'd
            $post_tech = "";
            echo $msg;
        }
    }
    // create if end
}
// funktsioon, mis eemaldab kõikvõimaliku üleliigse tekstist
function cleanInput($data)
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
示例#4
0
文件: answer.php 项目: Max1mov/eksami
    header("Location: login.php");
}
$send_answ = "";
$send_answ_error = "";
// *********************
if (isset($_POST["salvesta2"])) {
    if (empty($_POST["send_answ"])) {
        $send_answ_error = "See väli on kohustuslik";
    } else {
        $send_answ = cleanInput($_POST["send_answ"]);
    }
    if ($send_answ_error == "") {
        echo $send_answ;
        // functions.php failis käivina funktsiooni
        // msq on message funktsioonist mis tagasi saadame
        $msg = updateComment($send_answ);
        if ($msg != "") {
            //salvestamine õnnestus
            // teen tühjaks input value'd
            $post_tech = "";
            echo $msg;
        }
    }
    // create if end
}
// funktsioon, mis eemaldab kõikvõimaliku üleliigse tekstist
function cleanInput($data)
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
     $postIds = getAllPostIds();
     include VIEWS . 'contentCMSCreate.php';
     break;
 case 'update':
     if (!empty($_POST)) {
         $form_valid = true;
         // sanitization...
         $_POST['editor1'] = trim($_POST['editor1']);
         //validation...
         if ($_POST['editor1'] == '') {
             $error['editor1'] = 'You have not entered any content! Try again yeh...?';
             $form_valid = false;
         }
         // action taken if form filled in correctly...
         if ($form_valid == true) {
             updateComment($_GET['id'], $_SESSION['userId'], $_POST['postId'], $_POST['editor1']);
             // variables set for updateComment function to update values on db
             header('Location: ?page=cmsUpdated&goto=cmsCommentsTable');
         }
     }
     $id = $_GET['id'];
     $comment = getCommentById($id);
     $postIds = getAllPostIds();
     include VIEWS . 'contentCMSUpdate.php';
     break;
 case 'delete':
     $id = $_GET['id'];
     if (!empty($_POST)) {
         if ($_POST['deleteConf'] == 'Yes') {
             deleteComment($id);
             header('Location: ?page=cmsUpdated&goto=cmsCommentsTable');
<?php

session_start();
include "carpoolingDAO.php";
$commentText = $_POST["commentText"];
$commentId = $_POST["commentId"];
updateComment($commentId, $commentText);
?>

示例#7
0
    $media->setName($_POST['media-name']);
    if (!$media->save()) {
        return FALSE;
    }
    return $media->getId();
}
$id = FALSE;
switch ($_POST['area']) {
    case 'category':
        $id = createCategory();
        break;
    case 'cofilter':
        $id = createCommentfilter();
        break;
    case 'comment':
        $id = updateComment();
        break;
    case 'media':
        $id = updateMedia();
        break;
    case 'page':
        $id = createPage();
        break;
    case 'post':
        $id = createPost();
        deletePost2CategoryRelations($id);
        createPost2CategoryRelations($id);
        break;
    case 'user':
        $id = createUser();
        break;
示例#8
0
    $query = "update T_transaction set follower = '{$follower}', updatedDt = sysdate() where transactionId = '{$transactionId}'";
    $result = $conn->query($query);
    $jsonArray = array("status" => "ok");
    echo json_encode($jsonArray);
}
if ($_GET) {
    $dataType = trim($_GET["dataType"]);
    if ($dataType == "updateTransactionStatus") {
        $transactionId = trim($_GET["transactionId"]);
        $status = trim($_GET["status"]);
        updateTransactionStatus($conn, $transactionId, $status);
    } else {
        if ($dataType == "updateComment") {
            $transactionId = trim($_GET["transactionId"]);
            $comment = trim($_GET["comment"]);
            updateComment($conn, $transactionId, $comment);
        } else {
            if ($dataType == "findTeacherByMobile") {
                $mobile = trim($_GET["mobile"]);
                findTeacherByMobile($conn, $mobile);
            } else {
                if ($dataType == "updateTeacher") {
                    $transactionId = trim($_GET["transactionId"]);
                    $openId = trim($_GET["openId"]);
                    updateTeacher($conn, $transactionId, $openId);
                } else {
                    if ($dataType == "updateTrialTime") {
                        $transactionId = trim($_GET["transactionId"]);
                        $trialTime = trim($_GET["trialTime"]);
                        updateTrialTime($conn, $transactionId, $trialTime);
                    } else {
示例#9
0
if (isset($_POST["salvesta"])) {
    if (empty($_POST["send_email"])) {
        $send_email_error = "See väli on kohustuslik";
    } else {
        $send_email = cleanInput($_POST["send_email"]);
    }
    if (empty($_POST["send_tekst"])) {
        $send_tekst_error = "See väli on kohustuslik";
    } else {
        $send_tekst = cleanInput($_POST["send_tekst"]);
    }
    if ($send_tekst_error == "" && $send_email_error == "") {
        echo "andmed! " . $send_email . " ja parool on " . $send_tekst;
        // functions.php failis käivina funktsiooni
        // msq on message funktsioonist mis tagasi saadame
        $msg = updateComment($send_tekst, $send_email);
        if ($msg != "") {
            //salvestamine õnnestus
            // teen tühjaks input value'd
            $post_tech = "";
            echo $msg;
        }
    }
    // create if end
}
// funktsioon, mis eemaldab kõikvõimaliku üleliigse tekstist
function cleanInput($data)
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);