Exemple #1
0
function tools()
{
    // does a second check to ensure you still are an admin and got to this page some how.
    if (checkadmin()) {
        //add admin
        if (isset($_POST['addAdmin'])) {
            // if the add admin button is selected do the add admin function
            addAdmin();
        }
        //add location
        if (isset($_POST['addLocation'])) {
            // same thing as the add admin but for locations
            addLocation();
        }
        //add professor
        if (isset($_POST['addProfessor'])) {
            // now for professors
            addProfessor();
        }
        //add class
        if (isset($_POST['addClass'])) {
            // finally for classes
            addClass();
        }
    } else {
        header("Location:../index.php");
        // if you fail the check go back to index.php and does give the user an error.
    }
}
Exemple #2
0
    die;
}
require_once "inc/functions.php";
openPage("Initialisation");
echo "\r\nJust so you know, your title at the moment is {$loggedInUser->title}, and that can be changed in the admin panel. You registered this account on " . date("M d, Y", $loggedInUser->signupTimeStamp()) . ".";
echo "<h2>RAZ tables</h2>";
$result = mysqli_query($mysqli, "DELETE FROM account");
$result = mysqli_query($mysqli, "ALTER TABLE  `account` AUTO_INCREMENT = 1");
$result = mysqli_query($mysqli, "delete from sk_users where id >1");
$result = mysqli_query($mysqli, "ALTER TABLE  `sk_users` AUTO_INCREMENT = 2");
$result = mysqli_query($mysqli, "DELETE FROM sk_user_permission_matches WHERE USER_ID != 1");
$result = mysqli_query($mysqli, "DELETE FROM market");
echo "<h2>creation des users 'Professeurs'</h2>";
addProfessor("mel", "M&eacute;lanie", "*****@*****.**");
addProfessor("dom", "Dominique", "*****@*****.**");
addProfessor("xtophe", "Christophe", "*****@*****.**");
addProfessor("pierre", "Pierre", "*****@*****.**");
addProfessor("laurence", "Laurence", "*****@*****.**");
addProfessor("marc", "Marc", "*****@*****.**");
addProfessor("sophie", "Sophie", "*****@*****.**");
echo "<h2>creation des users 'Etudiants'</h2>";
for ($i = 1; $i < 201; $i++) {
    echo "<br/>creation de Groupe{$i}";
    $result = mysqli_query($mysqli, "INSERT INTO `sk_users` (`id`, `user_name`, `display_name`, `password`, `email`, `activation_token`, `last_activation_request`, `lost_password_request`, `active`, `title`, `sign_up_stamp`, `last_sign_in_stamp`) VALUES (NULL, 'groupe{$i}', 'Groupe {$i}', '9051a509f95691159c7ed617fd884f29af9213d747b13b6c7860fff6fb40cb24d', 'user{$i}@skema.edu', 'b3f4ed2c42cc370d457f9caa201617a8', 1377894239, 0, 1, 'Student', 1377894239, 1377898821);");
    $result = mysqli_query($mysqli, "SELECT id FROM `sk_users` WHERE user_name = 'Groupe{$i}';");
    list($idNew) = mysqli_fetch_row($result);
    $result = mysqli_query($mysqli, "INSERT INTO `sk_user_permission_matches` (`id`, `user_id`, `permission_id`) VALUES (NULL, '{$idNew}', '1');");
    $timeStamp = date("Y-m-d H:i:s");
    $result = mysqli_query($mysqli, "INSERT INTO `account` (`id`, `account1`, `account2`, `debit`, `credit`, `description`, timestamp) VALUES (NULL, '{$idNew}', NULL, NULL, '10000', 'Solde Initial','{$timeStamp}');");
}
closePage();
<?php

include 'functions.php';
if (!empty($_POST)) {
    if (!empty($_POST['submit'])) {
        $submit = $_POST['submit'];
        if ($submit == 'add') {
            if (!empty($_POST['professorPassword']) && !empty($_POST['professorUsername']) && !empty($_POST['selectedDepartmentId'])) {
                $departmentId = $_POST['selectedDepartmentId'];
                $professorUsername = $_POST['professorUsername'];
                $professorPassword = $_POST['professorPassword'];
                $isExecutedSuccessful = addProfessor($professorUsername, $professorPassword, $departmentId);
            }
        } else {
            if ($submit == 'change') {
                if (!empty($_POST['selectedProfessorId'])) {
                    $professorId = $_POST['selectedProfessorId'];
                    if (!empty($_POST['professorUsername'])) {
                        $professorUsername = $_POST['professorUsername'];
                        $isExecutedSuccessful = changeProfessorUsername($professorUsername, $professorId);
                    }
                    if (!empty($_POST['professorPassword'])) {
                        $professorPassword = $_POST['professorPassword'];
                        $isExecutedSuccessful = changeProfessorPassword($professorPassword, $professorId);
                    }
                }
            } else {
                if ($submit == 'transfer') {
                    if (!empty($_POST['selectedProfessorId']) && !empty($_POST['selectedDepartmentIdTo'])) {
                        $professorId = $_POST['selectedProfessorId'];
                        $departmentIdTo = $_POST['selectedDepartmentIdTo'];