<button type="submit" class="btn btn-primary" name="answer_submit" id="answer_submit">Submit</button> </fieldset> </form> </div> <div class="container"> <fieldset> <legend>Answers</legend> <?php $answer_content = GetQuestion_Answer($question_id); //print_r($answer_content); $i = 0; $num = count($answer_content); while ($i < $num) { $answer_uid = Get_UID_By_AID($answer_content[$i]['AID']); $up_count = GetUpCount($answer_content[$i]['AID']); $down_count = GetDownCount($answer_content[$i]['AID']); echo "<div class=\"jumbotron\">\n"; echo "<h6>Answer by:" . $answer_content[$i]['Name'] . "</h6>\n"; echo "<h6>Time:" . $answer_content[$i]['Time'] . "</h6>\n"; echo "<p><font size=\"3\">" . $answer_content[$i]['Content'] . "</font></p>"; if (isset($_SESSION['login']) && $_SESSION['login'] == true) { echo "<div id=\"answer_info\" style=\"display: none;\">" . $answer_content[$i]['AID'] . "</div>"; echo "<a href=\"#\" class=\"up_count_btn\" id=\"up_count_" . $answer_content[$i]['AID'] . "\"><span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\"></span><span class=\"count\"> " . $up_count . "</span> Up</a>"; echo "<span>     </span>"; echo "<div id=\"answer_info\" style=\"display: none;\">" . $answer_content[$i]['AID'] . "</div>"; echo "<a padding-left:10px href=\"#\" class=\"down_count_btn\" id=\"down_count_" . $answer_content[$i]['AID'] . "\"><span class=\"glyphicon glyphicon-thumbs-down\" aria-hidden=\"true\"></span></span><span class=\"count\"> -" . $down_count . "</span> Down</a>"; if ($answer_uid == $_SESSION['UID']) { echo "<br></br>"; echo "<a href=\"modifyanswer.php?var=" . $answer_content[$i]['AID'] . "&qid=" . $question_id . "\" class=\"btn btn-primary\" >Edit</a>";
<?php session_start(); // Not login include "DB.php"; $header = "Location: http://localhost/546Final/pages/index.php"; if (isset($_SESSION['login']) && $_SESSION['login'] == true) { } else { header("Location: http://localhost/546Final/pages/index.php"); return; } $UID = $_SESSION['UID']; if (isset($_POST['AID'])) { $WriterUID = Get_UID_By_AID($_POST['AID']); if ($WriterUID != $UID) { header($header); } $GRP = GetGroup($UID); //$header = "Location: http://localhost/546Final/pages/index.php"; //Permission Denied if ($GRP < 1) { header($header); return; } if (isset($_POST['AID']) && isset($_POST['Content'])) { Modify_Answer($_POST['AID'], $_POST['Content']); header($header); } } header($header);
<?php session_start(); if (isset($_SESSION['login']) && $_SESSION['login'] == true) { include "../include/DB.php"; $answer_id = $_GET['var']; $question_id = $_GET['qid']; $writer_id = Get_UID_By_AID($_GET['var']); if ($writer_id != $_SESSION['UID']) { header("Location: http://localhost/546Final/pages/index.php"); } $question_content = GetQuestion_ByID($question_id); $answer_content = GetQuestion_Answer($question_id); $i = 0; $num = count($answer_content); while ($i < $num) { if ($answer_content[$i]['AID'] == $answer_id) { $content_aid = $answer_content[$i]['Content']; } $i++; } //print_r($answer_content); } else { header("Location: http://localhost/546Final/pages/index.php"); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge">