Ejemplo n.º 1
0
 public function get_Room()
 {
     $pdo = Database::getDB();
     $stmt = $pdo->prepare("SELECT * From brain_rooms ORDER BY brim DESC");
     $stmt->execute();
     $result = $stmt->fetchAll();
     $brain_rooms = array();
     foreach ($result as $b) {
         $brain_Room = new brain_Room();
         $brain_Room->setRid($b['brim']);
         $brain_Room->setRoom_id($b['room_num']);
         $brain_Room->setUser_id($b['server_id']);
         $brain_Room->setCategory($b['category']);
         $brain_Room->setPlayers($b['players']);
         $brain_Room->setPlayer_type($b['player_type']);
         $brain_Room->setNum_of_players($b['num_of_players']);
         $brain_rooms[] = $brain_Room;
     }
     return $brain_rooms;
 }
Ejemplo n.º 2
0
    $dup = 'delete';
    header("location:.?action=View_brain_Question&dup=" . urlencode($dup) . "&cid=" . urlencode($_SESSION['cid']) . "&quest=''");
} elseif ($action == 'brain_addRoom') {
    if (isset($_SESSION['user'])) {
        $brain_users = $brain_UserDB->brain_getUser($_SESSION['user']);
    }
    $_SESSION['room_num'] = $_POST['room_num'];
    $_SESSION['user_id'] = $_POST['user_id'];
    $user_id = $_SESSION['user_id'];
    $room_num = $_SESSION['room_num'];
    $_SESSION['category'] = ucwords($_POST['category']);
    $_SESSION['players'] = $_POST['players'];
    $player_type = "Server";
    $num_of_players = 1;
    $brain_room->setRoom_id($_SESSION['room_num']);
    $brain_room->setUser_id($_SESSION['user_id']);
    $brain_room->setCategory($_SESSION['category']);
    $brain_room->setPlayers($_SESSION['players']);
    $brain_room->setPlayer_type($player_type);
    $brain_room->setNum_of_players($num_of_players);
    $brain_roomDB->brain_AddRoom($brain_room);
    $rid = $brain_roomDB->getRid($_SESSION['room_num']);
    $rooms_id = $rid->getRid();
    $player_type = $rid->getPlayer_type();
    $brain_joinRoom->setJid($rooms_id);
    $brain_joinRoom->setUser_id($_SESSION['user_id']);
    $brain_joinRoom->setRoom_num($room_num);
    $brain_joinRoom->setPlayer_type($player_type);
    //--------Reserve Question(Easy)----------------//
    $level = 'Easy';
    $brain_reserveQuestionDB->removeReservedQs($_SESSION['room_num']);