Example #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['ArtID'])) {
    if (VoteUp_Art($_POST['ArtID'], $_SESSION['UID']) == -1) {
        $Up = GetUpCount_Art($_POST['ArtID']);
        $Down = GetDownCount_Art($_POST['ArtID']);
    }
}
$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;
Example #2
0
								type="password"/>
								 <button id="LoginBtn" type="Button"
								value="Login">Login 	</button>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="container">
	<?php 
$article_id = $_GET['var'];
include "../include/DB.php";
$res_art = GetArticle($article_id);
$up_count = GetUpCount_Art($article_id);
$down_count = GetDownCount_Art($article_id);
echo "<div class=\"jumbotron\">\n";
echo "<h4>" . $res_art[0]['Title'] . "</h4>";
echo "<h6>Author:" . $res_art[0]['Name'] . "</h6>\n";
echo "<h6>Time:" . $res_art[0]['Time'] . "</h6>\n";
echo "<p>" . $res_art[0]['Content'] . "</p>";
if (isset($_SESSION['login']) && $_SESSION['login'] == true) {
    echo "<h4></h4>";
    echo "<div id=\"article_info\" style=\"display: none;\">" . $article_id . "</div>";
    echo "<a href=\"#\" class=\"up_count_art_btn\" id=\"up_count_art_" . $article_id . "\"><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=\"article_info\" style=\"display: none;\">" . $article_id . "</div>";
    echo "<a padding-left:10px href=\"#\" class=\"down_count_art_btn\" id=\"down_count_art_" . $article_id . "\"><span class=\"glyphicon glyphicon-thumbs-down\" aria-hidden=\"true\"></span></span><span class=\"count\">&nbsp-" . $down_count . "</span>&nbspDown</a>";
} else {
    echo "<h4></h4>";
    echo "<span class=\"glyphicon glyphicon-thumbs-up\" aria-hidden=\"true\"></span><span class=\"count\">&nbsp" . $up_count . "</span>";