Beispiel #1
0
 if ($_GET['action'] == editRoomType && $_SESSION['access'] >= 50 || $_GET['action'] == showRoomType) {
     //get the new location type corresponding to the ID
     $roomType = new RoomType($_GET['roomTypeID']);
     //if this is an update then update the room
     if (isset($_POST['updateRoomType'])) {
         updateRoomType($roomType);
     } else {
         displayRoomType($roomType);
     }
 } else {
     if ($_GET['action'] == editRooms && $_SESSION['access'] >= 50 || $_GET['action'] == showRooms) {
         //get the new location type corresponding to the ID
         $room = new Room($_GET['roomID']);
         //if this is an update then update the room
         if (isset($_POST['updateRoom'])) {
             updateRoom($room);
         } else {
             displayRooms($room);
         }
     } else {
         if ($_GET['action'] == addLocationType && $_SESSION['access'] >= 50) {
             $locationType = new LocationType();
             //if the user is adding the room, then add it
             if (isset($_POST['addLocationType'])) {
                 addLocationType($locationType);
             } else {
                 addLocationTypeForm();
             }
         } else {
             if ($_GET['action'] == addLocation && $_SESSION['access'] >= 50) {
                 $location = new Location();
$closing_hours = $_POST['clhours'];
$room = $_POST['roomnum'];
$max_cap = $_POST['maxcap'];
$rid = $_POST['room'];
$cid = $_POST['company'];
$bid = $_POST['branch'];
// start session which may be needed later
// start it now because it must go before headers
session_start();
// connect to database
$db = db_connect();
try {
    // check forms filled in
    if (!filled_out($_POST)) {
        throw new Exception('You have not filled the form out correctly. Please go back and try again.');
    }
    // update database functions
    updateCompany($db, $company, $date, $cid);
    updateBranch($db, $branch, $type, $opening_hours, $closing_hours, $longitude, $latitude, $bid);
    updateRoom($db, $room, $max_cap, $rid);
    // success head to success page
    $url = 'index.php?page=addsuccess';
    ob_end_clean();
    header("Location: {$url}");
    exit;
} catch (Exception $e) {
    // print error
    echo $e->getMessage();
    // exit
    exit;
}
Beispiel #3
0
 function updroom()
 {
     require_once $GLOBALS['where_scs'] . '/lib/lib.room.php';
     $id_room = importVar('id_room', true, 0);
     $re = updateRoom($id_room, $_POST['rules']);
     Util::jump_to('index.php?modname=room&op=room&result=' . ($re ? 'ok' : 'err'));
 }
Beispiel #4
0
if (isset($_SESSION["last_acted_on"]) && time() - $_SESSION["last_acted_on"] > 60 * 15 || !isset($_SESSION['user_name'])) {
    session_unset();
    // unset $_SESSION variable for the run-time
    session_destroy();
    // destroy session data in storage
    header('Location:index.php');
} else {
    session_regenerate_id(true);
    $_SESSION["last_acted_on"] = time();
    if (isset($_POST['update'])) {
        $no = $_POST['room_number'];
        $name = $_POST['name'];
        $tp = $_POST['room_type'];
        $des = $_POST['description'];
        $query = "update room set name='" . $name . "' , cat_id='" . $tp . "' , room_id='" . $des . "' where room_no='" . $no . "'";
        updateRoom($query);
        header('Location: room.php');
    }
    if (isset($_GET['number'])) {
        $number = $_GET['number'];
        $rooms = getRoom($number);
    }
    if (isset($_POST['add'])) {
        $no = getRoomId();
        $name = $_POST['name'];
        $tp = $_POST['room_type'];
        $des = $_POST['description'];
        $query = "insert into room values ('" . $no . "','" . $name . "' , '" . $tp . "' , '" . $des . "' )";
        UpdateRoom($query);
        header('Location: room.php');
    }
Beispiel #5
0
function add2Room($clientID, $user_id, $room)
{
    global $Server;
    $mes = 'Приглашен в комнату пользователем ' . $Server->wsClients[$clientID][13];
    // sendMess($id, $data);
    addHistory($user_id, $mes, '000', $room);
    if (getRoom($room, $user_id)) {
        updateRoom($room, false, $user_id);
    } else {
        updateRoom($room);
    }
    foreach ($Server->wsClients as $id => $data) {
        if ($data[15] != $room) {
            if ($data[12] == $user_id) {
                sendMess($id, array('System', $Server->wsClients[$clientID][13] . ' пригласил Вас в чат <a href="index.php?module=kChat&room=' . $room . '">"' . getRoomName($room, $data[12]) . '"</a>', '000;font-weight:bolder'));
                getRooms($id);
            }
        } else {
            getUsers($id, $room);
        }
    }
}
function getQueuePosition($_chatId, $_targetGroup, $_startTime = 0, $_position = 1)
{
    global $CONFIG;
    updateRoom($_chatId, CHAT_STATUS_OPEN, $_targetGroup);
    queryDB(true, "DELETE FROM `" . DB_PREFIX . DATABASE_ROOMS . "` WHERE `status` = 0 AND `last_active` < " . mysql_real_escape_string(time() - 20));
    $result = queryDB(true, "SELECT `id`,`time` FROM `" . DB_PREFIX . DATABASE_ROOMS . "` WHERE `status` = 0 AND `target_group`='" . mysql_real_escape_string($_targetGroup) . "' ORDER BY `time` ASC;");
    if ($result) {
        while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
            if ($row["id"] != $_chatId) {
                $_position++;
            } else {
                $_startTime = $row["time"];
                break;
            }
        }
    }
    define("CHAT_START_TIME", $_startTime);
    return $_position;
}
 function CreateChat($_internalUser, $_chatId)
 {
     $_internalUser->SetLastChatAllocation();
     $this->Chat = new Chat($this, $_internalUser, $_chatId);
     $this->Chat->InternalDestroy(false);
     $this->Chat->ExternalDestroy(false);
     $this->Chat->Save();
     updateRoom($_chatId, CHAT_STATUS_WAITING);
 }
Beispiel #8
0
<?php

session_start();
if (!isset($_SESSION['SESS_EMAIL'])) {
    die("login first");
}
include_once "../db_conx.php";
if ($_POST['toDo'] == "logOff") {
    session_destroy();
} else {
    if ($_POST['toDo'] == "displayRooms") {
        displayRooms();
    } elseif ($_POST['toDo'] == "deleteRoom") {
        deleteRoom($_POST['roomId']);
    } elseif ($_POST['toDo'] == "updateRoom") {
        updateRoom();
    } elseif ($_POST['toDo'] == "addRoom") {
        addRoom();
    } elseif ($_POST['toDo'] == "displaySubjects") {
        displaySubjects();
    } elseif ($_POST['toDo'] == "updateSubject") {
        updateSubject();
    } elseif ($_POST['toDo'] == "deleteSubject") {
        deleteSubject($_POST['subId']);
    } elseif ($_POST['toDo'] == "addSubject") {
        addSubject();
    } elseif ($_POST['toDo'] == "displayBatches") {
        displayBatches();
    } elseif ($_POST['toDo'] == "addBatch") {
        addBatch();
    } elseif ($_POST['toDo'] == "updateBatch") {