Example #1
0
include "php/school.php";
include "php/security.php";
$login = new user();
$manager = new manager();
$school = new school();
$sec = new security();
$logincheck = $login->islogin();
if ($logincheck != 1) {
    header("location: index.php");
} else {
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        if (isset($_POST['schoolid'])) {
            $schoolid = $_POST['schoolid'];
            $managerid = $_POST['managerid'];
            $shift = $_POST['shift'];
            $school->addmanagertoschool($managerid, $schoolid, $shift);
            header("location: schools.php");
        }
    }
    if ($_SERVER['REQUEST_METHOD'] == "GET") {
        if (isset($_GET['schoolid']) & isset($_GET['shift'])) {
            $schoolid = $sec->escape($_GET['schoolid']);
            $shift = $sec->escape($_GET['shift']);
            $schoolresult = $school->getschoolbyid($schoolid);
            if ($schoolresult->num_rows == 1) {
                $schoolrow = $schoolresult->fetch_assoc();
                $managerresult = $manager->getmanagers();
                if ($managerresult->num_rows > 0) {
                } else {
                    header("location: managers.php?error=هیچ مدیری برای انتحاب وجود ندارد ابتدا مدیر را ایجاد کنید");
                }