"Fossies" - the Fresh Open Source Software Archive

Member "mrbs-1.9.2/web/add.php" (14 Oct 2020, 1145 Bytes) of package /linux/www/mrbs-1.9.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "add.php" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.9.0_vs_1.9.1.

    1 <?php
    2 namespace MRBS;
    3 
    4 use MRBS\Form\Form;
    5 
    6 require "defaultincludes.inc";
    7 require_once "mrbs_sql.inc";
    8 
    9 
   10 // Check the CSRF token
   11 Form::checkToken();
   12 
   13 // Check the user is authorised for this page
   14 checkAuthorised(this_page());
   15 
   16 // Get non-standard form variables
   17 $name = get_form_var('name', 'string', null, INPUT_POST);
   18 $description = get_form_var('description', 'string', null, INPUT_POST);
   19 $capacity = get_form_var('capacity', 'int', null, INPUT_POST);
   20 $room_admin_email = get_form_var('room_admin_email', 'string', null, INPUT_POST);
   21 $type = get_form_var('type', 'string', null, INPUT_POST);
   22 
   23 // This file is for adding new areas/rooms
   24 $error = '';
   25 
   26 // First of all check that we've got an area or room name
   27 if (!isset($name) || ($name === ''))
   28 {
   29   $error = "empty_name";
   30 }
   31 
   32 // we need to do different things depending on if it's a room
   33 // or an area
   34 elseif ($type == "area")
   35 {
   36   $area = mrbsAddArea($name, $error);
   37 }
   38 
   39 elseif ($type == "room")
   40 {
   41   $room = mrbsAddRoom($name, $area, $error, $description, $capacity, $room_admin_email);
   42 }
   43 
   44 $returl = "admin.php?area=$area" . (!empty($error) ? "&error=$error" : "");
   45 location_header($returl);
   46