Esempio n. 1
0
<?php

session_start();
include "DB.php";
$dom = new DOMDocument();
$UpCount = $dom->createElement("Up_Count");
$DownCount = $dom->createElement("Down_Count");
$resp = $dom->createElement("Response");
$Up = -1;
$Down = -1;
if (isset($_SESSION['UID']) && isset($_POST['AID'])) {
    if (VoteUp($_POST['AID'], $_SESSION['UID']) == -1) {
        $Up = GetUpCount($_POST['AID']);
        $Down = GetDownCount($_POST['AID']);
    }
}
$UpN = $dom->createTextNode($Up);
$DownN = $dom->createTextNode($Down);
$UpCount->appendChild($UpN);
$DownCount->appendChild($DownN);
$resp->appendChild($UpCount);
$resp->appendChild($DownCount);
$dom->appendChild($resp);
echo $dom->saveXML();
return;
Esempio n. 2
0
		</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\">&nbsp" . $up_count . "</span>&nbspUp</a>";
            echo "<span>&nbsp &nbsp &nbsp</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\">&nbsp-" . $down_count . "</span>&nbspDown</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>";
            }
            if (isset($group) && $group >= 5) {