Esempio n. 1
0
<?php

require_once "autoload.php";
use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl;
use edu\uga\cs\recdawgs\entity\impl as Entity;
$logicLayer = new LogicLayerImpl();
$userName = trim($_POST['userName']);
try {
    // find admin or student
    $adminModel = new Entity\AdministratorImpl();
    $adminModel->setUserName($userName);
    $admin = $logicLayer->findAdmin($adminModel, -1)->current();
    $studentModel = new Entity\StudentImpl();
    $studentModel->setUserName($userName);
    $student = $logicLayer->findStudent($studentModel, -1)->current();
    // reset password
    $logicLayer->resetPassword($student, $admin);
    $successMsg = urlencode("Password successfully reset!");
    header("Location: ../login.php?status={$successMsg}");
} catch (\edu\uga\cs\recdawgs\RDException $rde) {
    $error_msg = urlencode($rde->string);
    header("Location: ../login.php?status={$error_msg}");
} catch (Exception $e) {
    $errorMsg = urlencode("Unexpected error");
    header("Location: ../login.php?status={$errorMsg}");
}
exit;
Esempio n. 2
0
use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl;
$logicLayer = new LogicLayerImpl();
//check to make sure none of the data is null or empty
foreach ($_POST as $inputData) {
    if ($inputData == "" or $inputData == null) {
        $errorMsg = urlencode("Missing form field");
        header("Location: ../index.php?status={$errorMsg}");
        exit;
    }
}
try {
    $user = null;
    if ($_SESSION['userType'] == 0) {
        $user = $logicLayer->findStudent(null, $_SESSION['userId'])->current();
    } else {
        $user = $logicLayer->findAdmin(null, $_SESSION['userId'])->current();
    }
    $match = $logicLayer->findMatch(null, $_POST['matchId'])->current();
    $match->setDate($_POST['date']);
    $logicLayer->objectLayer->storeMatch($match);
    $successMsg = urlencode("Match scheduled successfully!");
    header("Location: ../index.php?status={$successMsg}");
    echo $persistenceId;
} catch (\edu\uga\cs\recdawgs\RDException $rde) {
    $errorMsg = urlencode($rde->string);
    header("Location: ../index.php?status={$errorMsg}");
} catch (Exception $e) {
    $errorMsg = urlencode("Unexpected error");
    header("Location: ../index.php?status={$errorMsg}");
}
exit;