43 lines
2.1 KiB
PHP
43 lines
2.1 KiB
PHP
<?PHP
|
|
|
|
if (eregi("results.php", $_SERVER['SCRIPT_NAME'])) {
|
|
Header("Location: index.php"); die();
|
|
}
|
|
|
|
$questionList = mysql_query("SELECT * FROM gforum_SurveyQuestion WHERE Survey_ID_FK = 1 ORDER BY Question_ID;");
|
|
|
|
while($question = mysql_fetch_array($questionList)) {
|
|
echo ("<div class='question' style='clear: both; margin: 15px 0px 15px 0px;'>\n");
|
|
echo ("<span class='question_topic' style='font-weight: bold'>".$question['Question_Name'].": </span><br />\n");
|
|
echo("<span class='question_subtitle' style='font-style: italic'>".$question['Question_Description']."</span><br />\n");
|
|
$answerList = mysql_query("SELECT * FROM gforum_SurveyAnswer WHERE Question_ID_FK = ". $question['Question_ID']." ORDER BY Answer_Votes DESC;");
|
|
$totalVotes = 0;
|
|
while($answer = mysql_fetch_array($answerList)) {
|
|
echo ($answer['Answer_Name'].": ".$answer['Answer_Votes']."<br />\n");
|
|
$totalVotes = $totalVotes + $answer['Answer_Votes'];
|
|
}
|
|
echo("<strong>Total votes in this category: ".$totalVotes."</strong><br />\n");
|
|
//echo ("<input type='radio' name='".$question['Question_ID']."' value='0'>No Vote<br />");
|
|
echo ("</div>\n");
|
|
}
|
|
|
|
$tsNow = time();
|
|
$tsWeek = time() - (7 * 24 * 60 * 60);
|
|
$tsMonth = time() - (30 * 24 * 60 * 60);
|
|
$tsSixMonth = time() - (182.5 * 24 * 60 * 60);
|
|
|
|
echo("<h3>Forum Stats</h3><br />");
|
|
|
|
$row = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT(user_id_fk)) AS users FROM gforum_Post WHERE post_time < '".$tsNow."' AND post_time > '".$tsWeek."';"));
|
|
|
|
echo("Number of users who have posted in the past seven days: ".$row['users']."<br />\n");
|
|
|
|
$row = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT(user_id_fk)) AS users FROM gforum_Post WHERE post_time < '".$tsNow."' AND post_time > '".$tsMonth."';"));
|
|
|
|
echo("Number of users who have posted in the past thirty days: ".$row['users']."<br />\n");
|
|
|
|
$row = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT(user_id_fk)) AS users FROM gforum_Post WHERE post_time < '".$tsNow."' AND post_time > '".$tsSixMonth."';"));
|
|
|
|
echo("Number of users who have posted in the past six months: ".$row['users']."<br />\n");
|
|
|
|
?>
|