示例#1
0
$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;
}
示例#2
0
}
if ($_SERVER['REQUEST_METHOD'] == "GET" && !empty($_GET['method'])) {
    $request_parts = explode('/', $_GET['method']);
    $method = $request_parts[1];
    switch ($method) {
        case "addCompany":
            $jsondata = addCompany();
            break;
        case "getCompany":
            $jsondata = getCompany();
            break;
        case "editCompany":
            $jsondata = editCompany();
            break;
        case "updateCompany":
            $jsondata = updateCompany();
            break;
        case "deleteCompany":
            $jsondata = deleteCompany();
            break;
    }
    publishOutput($jsondata);
} else {
    $jsonoutput = array("status" => 0, "msg" => "Unauthorised Access!");
    publishOutput($jsonoutput);
}
///// All Calls ////////////////////////////////////////////////////////////
function addCompany()
{
    echo "hi";
    exit;