Exemple #1
0
<?php

/**
 * This updates the enrollment status for a student in the database
 */
require_once '../config.php';
require_once 'loggedin.php';
if (checkIfLoggedIn($_SESSION['LoggedIn'], $_SESSION['uname']) == 1) {
    if (isset($_POST['test_ID']) && !empty($_POST['test_ID']) && isset($_POST['stu_ID']) && !empty($_POST['stu_ID'])) {
        //Now insert values in student_test_status table
        $enroll_value = 1;
        try {
            $QueryTestStatus = $dbinfo->prepare("UPDATE student_test_status SET is_enabled=? WHERE stuid=? AND testid=?");
            $QueryTestStatus->execute(array($enroll_value, $_POST['stu_ID'], $_POST['test_ID']));
            //Everything is fine
        } catch (PDOException $e) {
            echo "Error updating: " . $e->getMessage();
            //Something went wrong
        }
    } else {
        echo "Could not get values";
    }
} else {
    echo "<p><b>You are currently not logged in. You will have to <a href=\"index.php\">login</a> to access this page.</b></p>";
}
<?php

require '../other/config.php';
// config.php is always required.
require '../functions/generalFunctions.php';
// generalFunctions.php is required on almost every page. It contains general functions used on many pages.
require '../functions/appointmentsOverviewFunctions.php';
// appointmentsOverviewFunctions.php contains all the functions needed on appointmentsoverview.php
checkIfLoggedIn();
// Check if the user is logged in.
checkIfSetDelete($con);
// Check if the user tried to delete an appointment.
checkIfSearchRights();
// Check if the user has search rights, in case he manually tried to search in the URL field.
$appointments = searchAppointments($con);
// An array of all the found appointments.
$users = isset($_GET['search']) && !empty($_GET['search']) ? searchUsers($con) : [];
//Only make an array of users when a search is set and it isn't empty.
require '../pages/requireshtml/htmlTillEndHeader.php';
?>
	<div class="column">
			<div class="lined">
				<h1>Afsprakenoverzicht</h1>
				<span class="bold-line"></span>
			</div>
			<p>
				U bent op de pagina waar u uw afspraken kunt inzien en verwijderen.
				Druk naast de afspraak op 'Meer info' om meer informatie te zien over deze afspraak.
			</p> 
			<p> Hier kunt u ook een toekomstige afspraak wijzigen.
				Druk naast de afspraak op 'Verwijderen' om deze afspraak te verwijderen.
Exemple #3
0
function checkIfMod()
{
    checkIfLoggedIn();
    if ($_SESSION['account_position'] != "Mod") {
        header("Location: /error.php?e=notenoughprivileges");
        return;
    }
}