This commit is contained in:
Joshua Perry 2023-02-05 23:04:45 +00:00
parent 1f487fe45e
commit dd6c8d1cab
6 changed files with 44 additions and 29 deletions

View File

@ -150,6 +150,7 @@ class Portal {
public function addUserSubmit() { public function addUserSubmit() {
if ($_SESSION['userType'] == 'admin') { if ($_SESSION['userType'] == 'admin') {
if($_POST['password'] != "") {
$record = [ $record = [
'username' => $_POST['username'], 'username' => $_POST['username'],
'password' => password_hash($_POST['password'], PASSWORD_DEFAULT), 'password' => password_hash($_POST['password'], PASSWORD_DEFAULT),
@ -170,6 +171,7 @@ class Portal {
]; ];
} }
} }
}
public function addJob() { public function addJob() {
if (isset($_GET['job_id'])) { if (isset($_GET['job_id'])) {

8
phpunit.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<phpunit>
<testsuites>
<testsuite name="tests">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>

View File

@ -1,12 +1,7 @@
<main class="home"> <main class="home">
<form method="post" action="/portal/addJob"> <form method="post" action="/portal/addJob">
<?php if ($archive) { ?> <?php if ($update) {?>
<input type="hidden" name="archived" value="n"/>
<?php }
else { ?>
<input type="hidden" name="archived" value="<?=$job->archived?>"/> <input type="hidden" name="archived" value="<?=$job->archived?>"/>
<?php }
if ($update) {?>
<label>Enter Job Title</label> <label>Enter Job Title</label>
<input type="text" name="title" value="<?=$job->title?>"/> <input type="text" name="title" value="<?=$job->title?>"/>
<label>Enter Job Description</label> <label>Enter Job Description</label>
@ -22,8 +17,12 @@
<input type="hidden" name="client_id" value="<?=$job->clientId?>" /> <input type="hidden" name="client_id" value="<?=$job->clientId?>" />
<input type="hidden" name="jobId" value="<?=$job->id?>"/> <input type="hidden" name="jobId" value="<?=$job->id?>"/>
<input type="submit" name="submit" value="Update"/> <input type="submit" name="submit" value="Update"/>
<?php }
else if ($archive) { ?>
<input type="hidden" name="archived" value="n"/>
<?php } <?php }
else { ?> else { ?>
<input type="hidden" name="archived" value="n"/>
<label>Enter Job Title</label> <label>Enter Job Title</label>
<input type="text" name="title"/> <input type="text" name="title"/>
<label>Enter Job Description</label> <label>Enter Job Description</label>

View File

@ -4,7 +4,7 @@
<label>Enter Username</label> <label>Enter Username</label>
<input type="username" name="username" value="<?=$user->username?>"/> <input type="username" name="username" value="<?=$user->username?>"/>
<label>Enter Password</label> <label>Enter Password</label>
<input type="password" name="password" value="<?=$user->password?>"/> <input type="password" name="password" value=""/>
<label>Enter User Type</label> <label>Enter User Type</label>
<input type="text" name="type" value="<?=$user->userType?>"/> <input type="text" name="type" value="<?=$user->userType?>"/>
<input type="hidden" name="user_id" value="<?=$user->id?>" /> <input type="hidden" name="user_id" value="<?=$user->id?>" />

6
tests/testTest.php Normal file
View File

@ -0,0 +1,6 @@
<?php
class DatabaseTableTest extends \PHPUnit\Framework\TestCase {
public function testFindColumnsValues() {
}
}
?>