function loggedin($db)
{
    do {
        echo "\n***************************************************\n";
        echo "\n Enter 1 to post a question\n";
        echo "\n Enter 2 to Answer a question\n";
        echo " \n Enter 3 to vote Posts\n";
        echo "\n Enter 0 to quit\n";
        echo "\n***************************************************\n";
        fscanf(STDIN, "%d\n", $val);
        switch ($val) {
            case 1:
                createPost();
                break;
            case 2:
                answerPost();
                break;
            case 3:
                castVote();
                break;
            default:
                echo "You entered other number\n";
                break;
        }
    } while ($val != 0);
}
Ejemplo n.º 2
0
     $xmlRoot->appendChild(doesUserExist($dbconn, $xmlDoc, $_REQUEST['id'], $_REQUEST['user_type']));
     break;
 case "addGoogleUser":
     $xmlRoot->appendChild(addGoogleUser($dbconn, $xmlDoc, $_REQUEST['id'], $_REQUEST['name'], $_REQUEST['email'], $_REQUEST['url']));
     break;
 case "addPost":
     $xmlRoot->appendChild(addPost($dbconn, $xmlDoc, $_REQUEST['id'], $_REQUEST['title'], $_REQUEST['text'], $_REQUEST['url'], $_REQUEST['sub']));
     break;
 case "userInfo":
     $xmlRoot->appendChild(userInfo($dbconn, $xmlDoc, $_REQUEST['id']));
     break;
 case "editUsername":
     $xmlRoot->appendChild(editUsername($dbconn, $xmlDoc, $_REQUEST['id'], $_REQUEST['username']));
     break;
 case "castVote":
     $xmlRoot->appendChild(castVote($dbconn, $xmlDoc, $_REQUEST['user_id'], $_REQUEST['post_id'], $_REQUEST['vote']));
     break;
 case "tallyVotes":
     $xmlRoot->appendChild(tallyVotes($dbconn, $xmlDoc, $_REQUEST['post_id']));
     break;
 case "checkForUserVote":
     $xmlRoot->appendChild(checkForUserVote($dbconn, $xmlDoc, $_REQUEST['post_id'], $_REQUEST['user_id']));
     break;
 case "addComment":
     $xmlRoot->appendChild(addComment($dbconn, $xmlDoc, $_REQUEST['user_id'], $_REQUEST['post_id'], $_REQUEST['comment']));
     break;
 case "getComments":
     $xmlRoot->appendChild(getComments($dbconn, $xmlDoc, $_REQUEST['post_id']));
     break;
 case "addNewUser":
     $xmlRoot->appendChild(addNewUser($dbconn, $xmlDoc, $_REQUEST['username'], $_REQUEST['password'], $_REQUEST['email']));
Ejemplo n.º 3
0
//Load interfaces for SQL tables
require_once "dbinfo.inc.php";
require_once "interface.attributes.inc.php";
require_once "interface.votingBox.inc.php";
require_once "interface.labels.inc.php";
//if there is an active vote
if (GETactive()) {
    //submit a NULL vote if it is the user's first visit
    //	OR
    //submit a 'real' vote if the user makes a selection
    if (!haveIVoted() || $_POST["selection"]) {
        castVote($_POST["selection"]);
    }
    //if the user chooses to revote, submit a NULL vote
    if ($_POST["reVoteButton"] == "Change Vote") {
        castVote("");
    }
}
//Decide to display the waiting page OR review page OR voting page
//if the vote is inactive, load a waiting page
//***NEEDS INTERFACE***
if (!GETactive()) {
    ?>
					<span class="graytitle">Waiting for a vote to begin.</span>
					<script language="javascript" type="text/javascript">setTimeout("location.reload();",10000);</script>
					<?php 
} else {
    if (haveIVoted()) {
        ?>
					<span class="graytitle">You voted for <?php 
        echo haveIVoted();