diff options
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | admin.php | 97 | ||||
-rw-r--r-- | client.php | 54 | ||||
-rw-r--r-- | dbinit.sql | 9 | ||||
-rw-r--r-- | index.php | 6 | ||||
-rw-r--r-- | style.css | 8 |
6 files changed, 178 insertions, 7 deletions
@@ -9,6 +9,11 @@ User types: Helpdesk: read, answer and close tickets Accountant: view invoices and change status Client: order services and open tickets +Service types: + premium, standard, free +Services: + VPS, VPN, webhost, bot host, game host, proxy, mirror, subdomain, storage, + nextcloud, jellyfin, email, matrix, xmpp, voip Report problems with CST or such as password changes to admin@arf20.com @@ -50,6 +55,8 @@ FILES: form to add, edit and delete user entries manageservices.php form to add, edit and delete service entries + manageorders.php + form to add, edit and delete order entries managetickets.php form to add, edit and delete ticket entries (assign, too, sends email to specific helpdesk person) manageinvoices.php @@ -64,9 +71,9 @@ SQL: Tables: users User logins id autoincrement, username, password (hash), email, email verification code, status { verified, unverified }, type { client, helpdesk, accountant, admin }, register date - services Available services and management notes etc + services Available services id autoincrement, name, type, billing, description - orders + orders List of user orders and management notes etc id autoincrement, service id, instance name, client id, order date, specific billing, comments tickets List of tickets id autoincrement, client id, title, body, status { open, closed, nofix }, asignee diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..a5012b8 --- /dev/null +++ b/admin.php @@ -0,0 +1,97 @@ +<?php + +session_start(); + +if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){ + header("location: /login.php"); + exit; +} + +$username = $_SESSION["username"]; +$type = $_SESSION["type"]; + +require_once "config.php"; + +// Get users +$sql = "SELECT id, username, status, type FROM users"; +$stmt = mysqli_prepare($link, $sql); +mysqli_stmt_execute($stmt); +$result = mysqli_stmt_get_result($stmt); +$users = $result->fetch_all(MYSQLI_ASSOC); + +// Get services +$sql = "SELECT id, name, type, billing FROM services"; +$stmt = mysqli_prepare($link, $sql); +mysqli_stmt_execute($stmt); +$result = mysqli_stmt_get_result($stmt); +$services = $result->fetch_all(MYSQLI_ASSOC); + +?> + +<!doctype html> +<html> + <head> + <meta charset="UTF-8"> + <link rel="stylesheet" type="text/css" href="/style.css"> + <title>ARFNET CSTIMS</title> + </head> + <body> + <header><a href="https://arf20.com/"> + <img src="arfnet_logo.png" width="64"><span class="title"><strong>ARFNET</strong></span> + </a></header> + <hr> + <main> + <div class="row"> + <div class="col8"> + <h2 class="center">ARFNET Client Service Ticket and Invoice Management System</h2> + <h3><?php echo strtoupper($type[0]).substr($type, 1); ?> panel</h3> + <div class="row"> + <div class="col2"> + <h3>Users</h3> + <table> + <tr><th>user</th><th>type</th><th>status</th></tr> + <?php + foreach ($users as $user) { + echo "<tr><td>".$user['username']."</td><td>".$user['type']."</td><td>".$user['status']."</tr>\n"; + } + ?> + </table> + </div> + <div class="col2"> + <h3>Service offerings</h3> + <table> + <tr><th>name</th><th>type</th><th>billing</th></tr> + <?php + foreach ($services as $service) { + echo "<tr><td>".$service['name']."</td><td>".$service['type']."</td><td>".$service['billing']."€/mo</tr>\n"; + } + ?> + </table> + </div> + <div class="col2"> + <h3>Orders</h3> + <!-- TODO PHP list of services --> + </div> + <div class="col2"> + <h3>Tickets</h3> + <!-- TODO PHP list of services --> + </div> + <div class="col2"> + <h3>Invoices</h3> + <!-- TODO PHP list of services --> + </div> + </div> + </div> + <div class="col2"> + <h3>Logged as <?php echo $username; ?></h3> + <h3><a href="/logout.php">Logout</h2> + <h3><a href="/manageusers.php">Manage users</h2> + <h3><a href="/manageservices.php">Manage services</h2> + <h3><a href="/manageorders.php">Manage orders</h2> + <h3><a href="/managetickets.php">Manage tickets</h2> + <h3><a href="/manageinvoices.php">Manage invoices</h2> + </div> + </div> + </main> + </body> +</html> diff --git a/client.php b/client.php new file mode 100644 index 0000000..615aac3 --- /dev/null +++ b/client.php @@ -0,0 +1,54 @@ +<?php + +session_start(); + +if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){ + header("location: /login.php"); + exit; +} + +$username = $_SESSION["username"]; +$type = $_SESSION["type"]; + +require_once "config.php"; + +?> + +<!doctype html> +<html> + <head> + <meta charset="UTF-8"> + <link rel="stylesheet" type="text/css" href="/style.css"> + <title>ARFNET CSTIMS</title> + </head> + <body> + <header><a href="https://arf20.com/"> + <img src="arfnet_logo.png" width="64"><span class="title"><strong>ARFNET</strong></span> + </a></header> + <hr> + <main> + <div class="row"> + <div class="col8"> + <h2>ARFNET Client Service Ticket and Invoice Management System</h2> + <h3><?php echo strtoupper($type[0]).substr($type, 1); ?> panel</h3> + <div class="row"> + <div class="col5"> + <h3>Active services</h3> + <!-- TODO PHP list of services --> + </div> + <div class="col5"> + <h3>Tickets</h3> + <!-- TODO PHP list of services --> + </div> + </div> + </div> + <div class="col2"> + <h3>Logged as <?php echo $username; ?></h3> + <h3><a href="/logout.php">Logout</h2> + <h3><a href="/order.php">Order a new service</h2> + <h3><a href="/openticket.php">Open ticket</h2> + </div> + </div> + </main> + </body> +</html> @@ -11,3 +11,12 @@ CREATE TABLE `arfnet2`.`users` ( `regdate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`) ); + +CREATE TABLE `arfnet2`.`services` ( + `id` INT NOT NULL AUTO_INCREMENT , + `name` VARCHAR(255) NOT NULL , + `type` ENUM('free','standard','premium') NOT NULL , + `billing` DECIMAL NOT NULL , + `description` TEXT NOT NULL , + PRIMARY KEY (`id`) +); @@ -12,15 +12,15 @@ <hr> <main> <div class="row"> - <div class="col1"> + <div class="col8"> <h2 class="center">ARFNET Client Service Ticket and Invoice Management System</h2> <p>State of the art hosting solution with ultra personalised service</p> <div class="row"> - <div class="col"> + <div class="col5"> <h3>Our cutting edge datacenter</h3> <img class="img" src="/rack.jpg"><br> </div> - <div class="col"> + <div class="col5"> <h3>Services and plans</h3> <!-- TODO PHP list of services --> </div> @@ -22,12 +22,12 @@ body { font-size: 150%; } -.col { +.col5 { float: left; width: 50%; } -.col1 { +.col8 { float: left; width: 80%; } @@ -55,3 +55,7 @@ body { margin-top: 200px; } +table, th, td { + border: 1px solid black; +} + |