function checkIfCommentPost() { if (isset($_POST["comment"])) { insertComment($_POST["comment"], $_POST["email"]); } }
getComments($db); } else { if (isset($_GET['loadforms'])) { loadForms($db); } else { if (isset($_GET['employee']) && !empty($_GET['employee'])) { getEmployee($db); } else { if (isset($_GET['e']) && !empty($_GET['e'])) { getEmployeeStatus($db); } else { if (isset($_GET['ename']) && !empty($_GET['ename'])) { getEId($db); } else { if (isset($_GET['commentSubmit']) && !empty($_GET['commentSubmit'])) { insertComment($db); } else { if (isset($_GET['getform']) && !empty($_GET['getform'])) { getForm($db); } else { if (isset($_GET['editform']) && !empty($_GET['editform'])) { editForm($db); } else { if (isset($_GET['eid']) && !empty($_GET['eid'])) { getRequirements($db); } else { if (isset($_GET['deleteform']) && !empty($_GET['deleteform'])) { deleteForm($db); } else { if (isset($_GET['deletefield']) && !empty($_GET['deletefield'])) { deleteField($db);
$comments["weaknesses"]["review_id"] = NULL; $comments["weaknesses"]["feature_id"] = NULL; $comments["weaknesses"]["game_id"] = $review["game_id"]; $comments["weaknesses"]["content"] = $review["weaknesses"]; $comments["weaknesses"]["review_id"] = $review["review_id"]; } if ($review["comments"] != NULL) { $comments["comments"]["game_id"] = NULL; $comments["comments"]["genre_id"] = NULL; $comments["comments"]["review_id"] = NULL; $comments["comments"]["feature_id"] = NULL; $comments["comments"]["content"] = $review["comments"]; $comments["comments"]["review_id"] = $review["review_id"]; } foreach ($comments as $comment) { insertComment($comment); } // echo "<!-- Send the transaction and unlock the database. -->\n"; $app->commit(); header("location: /app/"); exit; break; case "home": $title = "Comparative Review"; $active = "app"; include '../view/head.php'; include '../view/header.php'; include 'content/home.php'; break; default: $title = "Comparative Review";
printf("insert failed: %s\n", $connectComment->connect_errno); } $insertComment->bind_param('isss', $story_id, $comment_creator, $comment_to, $comment_content); $insertComment->execute(); $insertComment->close; ///////new message $comment_id; $connect = connectDatabase(); $queryComment = $connect->prepare("select id from comment order by comment_time DESC LIMIT 1"); if (!$queryComment) { printf("query failed: %s\n", $connect->connect_errno); } $queryComment->execute(); $queryComment->bind_result($commentId); if ($queryComment->fetch()) { $comment_id = $commentId; } $queryComment->close; //////insert new message $user_id = $_POST["user_name"]; $connectUnread = connectDatabase(); $insertUnread = $connectUnread->prepare("insert into unread_comment (user_id,comment_id) values (?, ?)"); if (!$insertUnread) { printf("insert failed: %s\n", $connectUnread->connect_errno); } $insertUnread->bind_param('si', $comment_to, $comment_id); $insertUnread->execute(); $insertUnread->close; } insertComment(); header("Location: showStory.php");
<div id="main"> <div id="guestbook" class="gb"> <?php //om formuläret för Kommentarer är ifyllt och inskickat skapas det i db include 'inc/functions.php'; // om formuläret för kommentar är ifyllt skapas det i db if (isset($_POST['comment'])) { $commentName = $_POST['name']; $commentText = $_POST['comment']; // if ($commentName == "" || $commentText == "") { $commentString = "<p style='color: red; font-weight: bold;'>All fields are required<p>"; } else { insertComment($commentName, $commentText); $commentString = "Thank you {$commentName}"; echo '<br />'; } } //$commentName =~ s/</</g; //$commentText =~ s/</</g; // visa info/felsträng om man gjort ett inlägg echo $commentString; // ansluter till db connectDb(); // ta ut alla comments, sparar dem via resultet i en egen array $query = mysql_query("SELECT * FROM comment ORDER BY date DESC LIMIT 0, 10") or die("error"); $commentRows = array(); while ($row = mysql_fetch_assoc($query)) { $commentRows[] = $row;
<?php /** * @author Amedeo Leo */ use Stichoza\GoogleTranslate\TranslateClient; session_start(); require 'manageDB.php'; $content = $_POST['content']; $idIdea = $_POST['idIdea']; $idUser = $_SESSION['email']; $scores = getScore($content); insertComment($idUser, $idIdea, $content, $scores); $comments = getCommentsByIdIdea($idIdea); $idea = getIdeaById($idIdea); $user_comment = getUserById($idUser); $flag = 0; $nameSurname = $user_comment['User']['name'] . " " . $user_comment['User']['surname']; echo $nameSurname; $followers = getFollowersByIdIdea($idIdea); $alreadySent = array(); foreach ($followers as $follower) { if ($follower['idUser'] != $idUser) { $mail_destinatario = "{$follower['idUser']}"; $mail_oggetto = "C'è un nuovo commento ad un'idea che stai seguendo!"; $title = "L'idea {$idea['Idea']['nome']} ha un nuovo commento!"; $nameSurname = $user_comment['User']['name'] . " " . $user_comment['User']['surname']; $body = "L'idea {$idea['Idea']['nome']} ha un nuovo commento: [{$nameSurname}]: {$content}"; $alreadySent[] = $follower['idUser']; $text_idea = $idea['Idea']['nome']; $text = "La idea " . $text_idea . " che stai seguendo ha un nuovo commento:[" . $nameSurname . "]: " . $content;
$comment_author = $_POST['comment_author']; $comment_email = $_POST['comment_email']; $comment_content = $_POST['comment_content']; //Error handling $error_messages = []; if (empty(trim($comment_author))) { $error_messages[] = "Author can not be empty"; } if (empty(trim($comment_email))) { $error_messages[] = "Email can not be empty"; } if (empty(trim($comment_content))) { $error_messages[] = "Comment can not be empty"; } if (count($error_messages) == 0) { insertComment($comment_author, $comment_email, date("Y-m-d H:i:s"), $comment_content, "Pending", $post_id); $success_message = "Comment waiting for approval"; $comment_author = $comment_email = $comment_content = ""; } } ?> <?php require "includes/navigation.php"; ?> <!-- Page Content --> <div class="container"> <div class="row">
$receiver = ""; if (isset($_COOKIE["email"])) { $sender = $_COOKIE["email"]; } if (isset($_POST["user"])) { $receiver = $_POST["user"]; } //Check who called this page if (isset($_POST["postid"])) { //We know It is a comment $postid = $_POST["postid"]; if (isset($_POST["comment"])) { //Comment inserted $comment = $_POST["comment"]; if (checkSQLInjection($comment)) { insertComment($comment, $sender, $receiver, $postid); } } else { //Get comments petition getPostComments($postid); } } else { //We know It is a chat message if (isset($_POST["check"])) { //Get chat messages getChatMessages($sender, $receiver); } else { //Here, We insert a new chat message $message = $_POST["message"]; if (checkSQLInjection($message)) { insertMessage($message, $sender, $receiver);
if ($new_likes[$i] == "yes") { $features[$i]["like_it"] += 1; } elseif ($new_likes[$i] == "no") { $features[$i]["not_like_it"] += 1; } updateFeature($features[$i]); echo "<!-- Insert comment -->"; echo "<!-- Comment: " . $new_comments[$i] . " -->"; if ($new_comments[$i] != "none") { $comments[$i]["genre_id"] = NULL; $comments[$i]["review_id"] = NULL; $comments[$i]["survey_id"] = NULL; $comments[$i]["game_id"] = $game_id; $comments[$i]["content"] = $new_comments[$i]; $comments[$i]["feature_id"] = $features[$i]["feature_id"]; insertComment($comments[$i]); } echo "<!-- Link feature with game -->"; if (checkGamesFeatures($game_id, $features[$i]["feature_id"]) == NULL) { linkGamesFeatures($game_id, $features[$i]["feature_id"]); } } } require '../model/reviews.php'; echo "<!-- Mark the review as parsed -->"; parseReview($review_id); echo "<!-- Send the transaction and unlock the database. -->\n"; $app->commit(); $_SESSION["info"] = "Review parsed with success."; header('location: /app/admin'); break;
<?php header('Content-type: application/json'); chdir('../../common'); require_once 'init.php'; chdir("../database"); require_once "storeFrontend.php"; chdir('../ajax/store'); if (isset($_GET["text"]) and isset($_GET["productId"]) and isset($_GET['storeId'])) { $userId = intval($_SESSION['storesLogin'][$_GET['storeId']]['userId']); $productId = intval($_GET["productId"]); if (isset($userId)) { $text = strip_tags($_GET["text"]); insertComment($productId, $userId, $text); echo json_encode(array("result" => "ok")); } else { echo json_encode(array("result" => "not logged in")); } } else { echo json_encode(array("result" => "missingParams")); }
$fnum = isset($_REQUEST['fnum']) ? $_REQUEST['fnum'] : false; $delete_attach_save_files = isset($_REQUEST['delete_attach_files[]']) ? $_REQUEST['delete_attach_files[]'] : false; deleteComunity($fnum); foreach ($delete_attach_files as $delete_attach_file) { deleteComunity_attach_file($delete_attach_file['savefile']); } $action = 600; header("location:../view/MainView.php?action={$action}"); break; //댓글 달기 //댓글 달기 case 620: $CC = isset($_REQUEST['comment_content']) ? $_REQUEST['comment_content'] : false; $fnum = isset($_REQUEST['fnum']) ? $_REQUEST['fnum'] : false; $mnum = isset($_REQUEST['mnum']) ? $_REQUEST['mnum'] : false; insertComment($fnum, $mnum, $CC); $action = 610; break; //답글 달기 //답글 달기 case 630: $parentinfo['parent_sub'] = isset($_REQUEST['parent_sub']) ? $_REQUEST['parent_sub'] : false; $parentinfo['parent_con'] = isset($_REQUEST['parent_con']) ? $_REQUEST['parent_con'] : false; $parentinfo['parent_fam'] = isset($_REQUEST['parent_fam']) ? $_REQUEST['parent_fam'] : false; $parentinfo['parent_ord'] = isset($_REQUEST['parent_ord']) ? $_REQUEST['parent_ord'] : false; $parentinfo['parent_stp'] = isset($_REQUEST['parent_stp']) ? $_REQUEST['parent_stp'] : false; $_SESSION['parentinfo'] = $parentinfo; break; //답글 저장 버튼 액션 (답글 저장) //답글 저장 버튼 액션 (답글 저장) case 631:
require_once '../phpInclude/AdminClass.php'; require_once '../easyapns/apns.php'; require_once '../easyapns/classes/class_DbConnect.php'; $db = new DbConnect('localhost', 'codebrew_super', 'core2duo', 'codebrew_nusit'); $db->show_errors(); //error_reporting(E_ALL); $token = $_REQUEST['token']; $share_id = $_REQUEST['share_id']; $comment = $_REQUEST['comment']; $path = BASE_PATH . "/timthumb.php?src=uploads/"; $comment_id = array(); $all_comments = array(); if (!empty($token) && !empty($share_id) && !empty($comment)) { $users_id = getUsersId($token); if (!empty($users_id)) { $comment_id = insertComment($users_id, $share_id, $comment); $res = getAllComments($share_id, $users_id); if (!empty($comment_id)) { $success = "1"; $msg = "comment added!"; if (!empty($res)) { $all_comments = $res; } $sql = "SELECT C.share_id as sid, C.users_id, P.id as pid, P.url, U.id as uid, U.name, CONCAT( '{$path}', profile_pic ) AS profile_pic, C.created_on,\n\t\t\t\t\t\t\tCASE \n\t\t\t\t\t\t\t\tWHEN DATEDIFF( NOW( ) , C.created_on ) !=0\n\t\t\t\t\t\t\t\tTHEN CONCAT( DATEDIFF( NOW( ) , C.created_on ) , 'd ago' ) \n\t\t\t\t\t\t\t\tWHEN HOUR( TIMEDIFF( NOW( ) , C.created_on ) ) !=0\n\t\t\t\t\t\t\t\tTHEN CONCAT( HOUR( TIMEDIFF( NOW( ) , C.created_on ) ) , 'h ago' ) \n\t\t\t\t\t\t\t\tWHEN MINUTE( TIMEDIFF( NOW( ) , C.created_on ) ) !=0\n\t\t\t\t\t\t\t\tTHEN CONCAT( MINUTE( TIMEDIFF( NOW( ) , C.created_on ) ) , 'm ago' ) \n\t\t\t\t\t\t\t\tELSE CONCAT( SECOND( TIMEDIFF( NOW( ) , C.created_on ) ) , 's ago' ) \n\t\t\t\t\t\t\tEND AS time_since\n\t\t\t\t\t\t\t\tFROM `comment` AS C\n\t\t\t\t\t\t\t\tJOIN `share` AS S ON S.id=C.share_id\n \t\t\t\t\t\t\t\tJOIN `post` AS P ON P.id = S.post_id\n\t\t\t\t\t\t\t\tJOIN `users` AS U ON U.id = C.users_id\n\t\t\t\t\t\t\t\tWHERE C.id =:comment_id"; $sth = $conn->prepare($sql); $sth->bindValue(":comment_id", $comment_id); try { $sth->execute(); } catch (Exception $e) { } $result = $sth->fetchAll(PDO::FETCH_ASSOC);