Exemplo n.º 1
0
// question.php
// Handle insert, update and delete of
// an individual question.
//
require_once 'includes/global.inc.php';
require_once 'classes/Question.class.php';
require_once 'classes/QuestionTools.class.php';
//check to see if they're logged in
if (!isset($_SESSION['logged_in'])) {
    header("Location: login.php");
}
//get the user object from the session
$userID = $_SESSION["userID"];
$uTool = new UserTools();
$user = $uTool->get($userID);
if ($user->userPriv != 'A') {
    header("Location: index.php");
}
$question = null;
$questionID = "";
$mode = "";
//check to see that the form has been submitted
if (isset($_POST['questionID'])) {
    $questionID = $_POST['questionID'];
    $data['id'] = $questionID;
    $data['title'] = $_POST['title'];
    $data['type'] = $_POST['type'];
    $data['text'] = $_POST['text'];
    $question = new Question($data);
} elseif (isset($_GET['questionID'])) {
Exemplo n.º 2
0
require_once '../../php/classes/db/DB.class.php';
require_once '../../php/classes/controller/GroupTools.class.php';
require_once '../../php/classes/controller/UserTools.class.php';
/*
require_once '../classes/obj/Group.class.php';
require_once '../classes/obj/User.class.php';
require_once '../classes/db/DB.class.php';
require_once '../classes/controller/GroupTools.class.php';
require_once '../classes/controller/UserTools.class.php';
*/
$db = new DB();
$db->connect();
$userTools = new UserTools();
$groupTools = new GroupTools();
if (isset($_POST['getGroup'])) {
    echo json_encode($groupTools->get($_SESSION['groupID']));
} else {
    if (isset($_POST['getMember'])) {
        echo "getting member " . $_POST['getMember'];
        echo json_encode($userTools->get($_POST['getMember']));
    }
}
/*
session_start();
if(isset($_SESSION['logged_in'])){
	$user = unserialize($_SESSION['user']);
	$_SESSION['user'] = serialize($userTools->get($user->id));
}
//leaving above unimplemented on account of lack of
any sort of login or authentication system or stuff
*/
Exemplo n.º 3
0
<?php

//global.inc.php
//start the session
session_name("Commentz");
session_start();
require_once 'classes/User.class.php';
require_once 'classes/UserTools.class.php';
require_once 'classes/DB.class.php';
require_once 'includes/navbar.inc.php';
require_once 'includes/utils.inc.php';
//connect to the database
$db = new DB();
$db->connect();
//initialize UserTools object
$userTools = new UserTools();
//refresh session variables if logged in
if (isset($_SESSION['logged_in'])) {
    $user = unserialize($_SESSION['user']);
    $_SESSION['user'] = serialize($userTools->get(3));
}
Exemplo n.º 4
0
<?php

error_reporting(E_ERROR | E_PARSE | E_WARNING);
// error_reporting(E_ALL);
//start the session
session_start();
// Requirements
require_once '../../libs/nocsrf.php';
require_once '../../classes/User.class.php';
require_once '../../classes/UserTools.class.php';
require_once '../../classes/DB.class.php';
require_once '../../classes/Account.class.php';
require_once '../../includes/constants.inc.php';
require_once '../../utils/InputValidation.util.php';
//connect to the database
$db = DB::getInstance();
$db->connect();
//initialize UserTools object
$userTools = new UserTools();
//refresh session variables if logged in
if (isset($_SESSION['logged_in'])) {
    $user = unserialize(Validation::xss_clean($_SESSION['user']));
    $_SESSION['user'] = serialize($userTools->get(Validation::xss_clean($_SESSION["emailId"])));
}
Exemplo n.º 5
0
<?php

require_once 'classes/User.class.php';
require_once 'classes/UserTools.class.php';
require_once 'classes/DB.class.php';
//connect to the database
$db = new DB();
$db->connect();
//initialize UserTools object
$userTools = new UserTools();
//start the session
session_start();
$current_user;
$logged_in = false;
//refresh session variables if logged in
if (isset($_SESSION['logged_in'])) {
    $current_user = unserialize($_SESSION['user']);
    $_SESSION['user'] = serialize($userTools->get($current_user->id));
    $current_user = unserialize($_SESSION['user']);
    $logged_in = true;
}
Exemplo n.º 6
0
// from.php
// Allows users to see comments to them from
// other students.
//
require_once 'includes/global.inc.php';
require_once 'classes/Answer.class.php';
require_once 'classes/AnswerTools.class.php';
//check to see if they're logged in
if (!isset($_SESSION['logged_in'])) {
    header("Location: login.php");
}
$aTool = new AnswerTools();
//get the user object from the session
$userID = $_SESSION["userID"];
$uTool = new UserTools();
$user = $uTool->get($userID);
$fromID = "";
$fromUser = null;
//
// See who is selected from the user popup menu. This is
// who we want to see comments from.
//
if (isset($_POST['fromID'])) {
    $fromID = $_POST['fromID'];
} else {
    // If no one is selected, select the first one in the menu.
    $db = new DB();
    $rows = $db->select2("id", "users", "", "userPriv, lastName");
    $fromID = $rows[0]["id"];
}
$fromUser = $uTool->get($fromID);
Exemplo n.º 7
0
require_once 'classes/Answer.class.php';
require_once 'classes/AnswerTools.class.php';
//check to see if they're logged in
if (!isset($_SESSION['logged_in'])) {
    header("Location: login.php");
}
$aTool = new AnswerTools();
$uTool = new UserTools();
//get the user object from the session
$userID = $_SESSION["userID"];
if ($userID == "") {
    echo "Lost userID SESSION variable...<br>";
    $uTool->logout();
    header("Location: login.php");
}
$user = $uTool->get($userID);
$toID = "";
$toUser = null;
//
// See who is selected from the user popup menu. This is
// who we want to send comments to.
//
if (isset($_POST['toID'])) {
    $toID = $_POST['toID'];
} else {
    // If no one is selected, select the first one in the menu.
    $db = new DB();
    $rows = $db->select2("id", "users", "userPriv='S'", "lastName");
    $toID = $rows[0]["id"];
}
$toUser = $uTool->get($toID);