<?php require_once "./database.php"; ?> <?php if (isset($_POST['q_id'])) { if ($_POST['type'] == 'answer') { postAnswer($_POST); } } if (isset($_GET['q_id'])) { $q_id = $_GET['q_id']; $question = getQuestion($q_id); $answers = getAnswers($q_id); } else { die('Error Query [' . $connect->error . ']'); } ?> <script type="text/javascript"> function vote(id,type,result){ var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { if(type == 'question') document.getElementById("qvote").innerHTML = xhttp.responseText; else document.getElementById("avote"+id).innerHTML = xhttp.responseText; } }
require_once "./includes/mysql.php"; include "./includes/header.php"; ?> <?php if (isset($_POST['question_id'])) { if ($_POST['type'] == 'answer') { postAnswer($_POST); } } if (!isset($_GET['id'])) { echo "<div class=\"error\">Please give us the question id so we can show you the question.</div>"; } else { $question = getQuestion($_GET['id']); $answers = getAnswers($_GET['id']); ?> <div id="question-page"> <div class="section"> <h2 class="underlined"><?php echo $question['title']; ?> </h2> <div class="question" id="question-<?php echo $question['question_id']; ?> "> <div class="row"> <div class="col vote"> <a href="javascript:voteUp(<?php
$username = $_GET["username"]; $password = $_GET["password"]; $testModeDb = new TestModeDatabase(); $params = $testModeDb->getTestParams(); if ($params["answerIsOpen"] != 0) { $qSeed = $params["seed"]; $qAmt = $params["questionAmount"]; $qTopics = $params["topics"]; $retrievedA = $testModeDb->getUserAnswer($username, $password); if ($retrievedA == false) { return; } for ($n = 0; $n < count($retrievedA); $n++) { $sAnsArr[$n] = $retrievedA[$n]; } getAnswers($qAmt, $qTopics); } echo json_encode($ansList); } else { if ($mode == MODE_TEST_GET_STUDENT_ANSWERS) { $username = $_GET["username"]; $password = $_GET["password"]; $testModeDb = new TestModeDatabase(); echo json_encode($testModeDb->getUserAnswer($username, $password)); } else { if ($mode == MODE_ADMIN) { $password = $_GET["password"]; $adminDb = new AdminDatabase(); echo $adminDb->validate($password) ? 1 : 0; } else { if ($mode == MODE_ADMIN_GET_CONFIG) {
<div class="pool-area"> <h2 class="alert alert-success" >Sorular</h2> <?php while ($question = mysql_fetch_array($questions)) { ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><?php echo $question[2]; ?> </h3> </div> <div class="panel-body"> <?php $answers = getAnswers($question[0]); while ($answer = mysql_fetch_array($answers)) { if ($answer[1] != null) { ?> <li> <?php echo $answer[1]; } ?> </li> <?php } ?> </div> </div> <?php
$answerText = $_REQUEST["answerText"]; postAnswer($qId, $answerText); } $qDetails = getQuestionBasicDetails($qId); echo "<table><tr><td><img src='images/Disscussion.png'/></td><td><font class='headerItem'>" . $qDetails['itemName'] . " discussion page</font></td></tr></table>"; echo "<font class='headerClass'>" . $qDetails['className'] . "</font>"; //echo "<h1><img src='images/Disscussion.png'/>".$qDetails['itemName']."</h1>"; //echo "<h2>".$qDetails['className']."</h2>"; echo "<table width='100%'><tr><td class='userblock' width='100px'>"; echo "<center><img src='imgs/users/Dummy_user_small.png'/><br><center><a class='text' href='#'>" . $qDetails['qPostedBy'] . "</a></center>"; echo "</td><td class='questionblock'>"; echo "<b class='text'>" . $qDetails['qText'] . "</b>"; echo "<br><p class='text'> Asked on " . $qDetails['qPostedOn'] . " </p>"; echo "</td></tr></table>"; echo "<BR>"; $allAns = getAnswers($qId); while ($row = mysql_fetch_assoc($allAns)) { $ansId = $row['ans_id']; $ansQesId = $row['qus_id']; // Mostly woul't hav any significance' $ansDesc = $row['ans_desc']; $ansPostedBy = $row['ans_posted_by']; $ansPostedOn = $row['ans_posted_on']; echo "<table width='100%'><tr><td class='userblock' width='100px'>"; echo "<center><img src='imgs/users/Dummy_user_small.png'/><br><center><a class='text' href='#'>" . $ansPostedBy . "</a></center>"; echo "</td><td class='answerblock'>"; echo "<b class='text'>" . $ansDesc . "</b>"; echo "<br><p class='text'> Posted on " . $ansPostedOn . " </p>"; echo "</td></tr></table>"; //echo "<h3>".$ansDesc."</h3>"; //echo "<p>Posted By: ".$ansPostedBy." on ".$ansPostedOn."</p>";
?> class="edit"> edit </a> | <a href=<?php echo $deleteURL; ?> onclick="return validateDelete()" class="delete"> delete </a> </p> </div> </div> <?php getCountAnswers(); ?> <?php getAnswers(); ?> <!-- <div class="answer-container"> <div class="vote-place"> <img src="images/up-arrow.png" class="arrow-images"> <h1>6</h1> <img src="images/down-arrow.png" class="arrow-images"> </div> <div class="full-question"> <p>The answer content goes here Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
$question['q_id'] = $_POST['q_id']; updateQuestion($question); } else { $answer['q_id'] = $_GET['q_id']; $answer['name'] = test_input($_POST['name']); $answer['email'] = test_input($_POST['email']); $answer['content'] = test_input($_POST['content']); addAnswer($answer); } } ?> <?php $q_id = $_GET['q_id']; $question = getQuestion($q_id); $tabAnswer = getAnswers($q_id); $nAnswer = mysqli_num_rows($tabAnswer); ?> <div class="view"> <h1>Simple Stack Exchange</h1><br> <h2 id="title"><?php echo $question['topic']; ?> </h2> <hr> <div class="row"> <div class="vote-col-1"> <div><img src="/assets/up.png" onclick="vote('question', <?php echo $q_id; ?>