Exemplo n.º 1
0
<?php

include_once "include/greetingHeader.php";
include_once "include/functions.php";
include_once "dao/UserDao.php";
include_once "services/UserServices.php";
if (isset($_POST['Submit'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    //Input Validations
    if ($username == '' || $password == '') {
        echo '<div class="ui error message" style="margin-top: 5%"><div class="header">ERROR</div> Please enter your username and/or password.</div>';
    } else {
        $user_access_object = new UserServices();
        $user = $user_access_object->login($username, $password);
        if ($user) {
            //Login Successful
            $_SESSION['SESS_USER_ID'] = $user->getId();
            $_SESSION['SESS_USER_NAME'] = $user->getName();
            $_SESSION['SESS_USER_USERNAME'] = $user->getUsername();
            $_SESSION['SESS_USER_PASSWORD'] = $user->getPassword();
            session_write_close();
            redirect_to("bugPage.php");
        } else {
            echo '<div class="ui error message" style="margin-top: 5%"><div class="header">ERROR</div> Wrong username or password combination.</div>';
        }
    }
}
?>
    <div class="ui three column relaxed grid" style="margin-top: 3%;">
        <div class="column"></div>
Exemplo n.º 2
0
<?php

include_once "include/greetingHeader.php";
include_once "services/BugServices.php";
include_once "services/UserServices.php";
include_once "services/StatusServices.php";
include_once "models/Bug.php";
$bug_id = $_REQUEST['id'];
$bug_access_object = new BugServices();
$bug = $bug_access_object->getBugById($bug_id);
$user_access_object = new UserServices();
$users = $user_access_object->getAllUsers();
$status_access_object = new StatusServices();
$statuses = $status_access_object->getAllStatus();
?>

<?php 
if (isset($_POST['editBug'])) {
    $title = $_POST['title'];
    $description = $_POST['description'];
    $status = $_POST['status'];
    $user_id = $_POST['user'];
    if ($title == '') {
        $title = $bug->getTitle();
    }
    if ($description == '') {
        $description = $bug->getDescription();
    }
    if ($status == $bug->getStatus()->getNumber() || $status == 99) {
        $status = $bug->getStatus()->getNumber();
    }
Exemplo n.º 3
0
<?php

include_once "include/greetingHeader.php";
include_once "dao/BugDao.php";
include_once "dao/UserDao.php";
include_once "services/UserServices.php";
include_once "services/BugServices.php";
$user_access_object = new UserServices();
$user = $user_access_object->getUserById($_SESSION['SESS_USER_ID']);
$bug_access_object = new BugServices();
?>

<?php 
if (isset($_POST['submitBug'])) {
    $title = $_POST['title'];
    $description = $_POST['description'];
    //Input Validations
    if ($title == '' || $description == '') {
        echo '<div class="ui error message" style="margin-top: 5%"><div class="header">ERROR</div> Title and/or description field(s) missing input.</div>';
    } else {
        $bug = new Bug($title, $description, $user, new Status(null, "OPEN", 1));
        $bug_access_object->insertNewBug($bug);
        echo '<div class="ui success message" style="margin-top: 5%"><div class="header">SUCCESS</div> Bug has been stored.</div>';
    }
}
?>
<div class="ui one column relaxed grid" style="margin-top: 3%;">
    <div class="column">
        <div class="ui fluid form segment">
            <div class="two fields">
                <div class="field">