Ejemplo n.º 1
0
    <?php 
// Writes Admin item in navigation only if user is admin
if (isAdmin($conn, $username)) {
    echo "<li class='admin'><a href='/admin.php'>Admin</a></li>";
}
?>
    <li class="loginout" style="float:right;border-left: 1px solid #ddd;"><a href="/logout.php">Log out</a></li>
  </ul>
<!--Close nav-->
<div id="container">
  <div id="content">
    <center>
    <?php 
if (isset($_POST["submitbooking"])) {
    // creates a recurring booking
    createRecurringBooking($conn, $username);
}
// if
// Function to create a recurring booking
function createRecurringBooking($conn, $username)
{
    try {
        echo "<p id='log'>";
        echo "Creating recurring booking...<br>";
        // Sets all variables from the form POST
        // set table, throw error if empty
        // The value provided is now of format
        // 'type,table', so we need to explode this to find table name
        $tablestring = $_POST["selectresource"];
        if (!$tablestring) {
            throw new Exception("Table cannot be empty<br>");
    <?php 
// Writes Admin item in navigation only if user is admin
if (isAdmin($conn, $username)) {
    echo "<li class='admin'><a href='/admin.php'>Admin</a></li>";
}
?>
    <li class="loginout" style="float:right;border-left: 1px solid #ddd;"><a href="/logout.php">Log out</a></li>
  </ul>
<!--Close nav-->
<div id="container">
  <div id="content">
    <center>
    <?php 
if (isset($_POST["submitbooking"])) {
    // creates a recurring booking
    createRecurringBooking($conn);
}
// if
// Function to create a recurring booking
function createRecurringBooking($conn)
{
    try {
        echo "Creating recurring booking<br>";
        // Sets all variables from the form POST
        // set table, throw error if empty
        // The value provided is now of format
        // 'type,table', so we need to explode this to find table name
        $tablestring = $_POST["selectresource"];
        if (!$tablestring) {
            throw new Exception("Table cannot be empty<br>");
        }