Compare commits

...

2 Commits

Author SHA1 Message Date
Flatlogic Bot
cf8c53640a Auto commit: 2025-10-08T06:10:35.241Z 2025-10-08 06:10:35 +00:00
Flatlogic Bot
b1030df0f7 mms 2025-10-08 05:53:42 +00:00
20 changed files with 1397 additions and 148 deletions

23
accounts.php Normal file
View File

@ -0,0 +1,23 @@
<?php
require_once 'auth.php';
$page_title = 'Akun PPPoE/Hotspot';
require_once 'partials/header.php';
?>
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center">
<h1 class="h3 mb-0 text-gray-800"><?php echo htmlspecialchars($page_title); ?></h1>
<div>
<a href="index.php" class="btn btn-secondary mr-2">
<i data-feather="arrow-left" class="mr-1"></i> Kembali
</a>
<button class="btn btn-primary"><i data-feather="plus" class="mr-2"></i>Create Account</button>
</div>
</div>
<hr>
<p>PPPoE/Hotspot account management page content goes here.</p>
</div>
<?php require_once 'partials/footer.php'; ?>

188
assets/css/custom.css Normal file
View File

@ -0,0 +1,188 @@
/* General Body Styles */
body {
font-family: '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Helvetica Neue', 'Arial', 'sans-serif';
background-color: #F8F9FA;
color: #212529;
display: flex;
min-height: 100vh;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Georgia', serif;
}
/* Main Wrapper */
.wrapper {
display: flex;
width: 100%;
align-items: stretch;
}
/* Sidebar Styles */
#sidebar {
min-width: 250px;
max-width: 250px;
background: #FFFFFF;
color: #212529;
transition: all 0.3s;
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
display: flex;
flex-direction: column;
}
#sidebar.active {
margin-left: -250px;
}
#sidebar .sidebar-header {
padding: 20px;
background: linear-gradient(45deg, rgba(0, 123, 255, 0.1), rgba(0, 123, 255, 0));
border-bottom: 1px solid #e9ecef;
text-align: center;
}
#sidebar .sidebar-header h3 {
color: #0056b3;
font-size: 1.5rem;
margin-bottom: 0;
}
#sidebar ul.components {
padding: 20px 0;
border-bottom: 1px solid #e9ecef;
flex-grow: 1;
}
#sidebar ul p {
color: #212529;
padding: 10px;
}
#sidebar ul li a {
padding: 15px 20px;
font-size: 1.1em;
display: block;
color: #343a40;
border-left: 3px solid transparent;
transition: all 0.2s ease-in-out;
}
#sidebar ul li a:hover {
color: #007BFF;
background: #F8F9FA;
border-left-color: #007BFF;
}
#sidebar ul li.active > a, a[aria-expanded="true"] {
color: #0056b3;
background: #F8F9FA;
border-left-color: #007BFF;
}
#sidebar .logout-link a {
border-top: 1px solid #e9ecef;
}
/* Content Styles */
#content {
width: 100%;
padding: 20px;
min-height: 100vh;
transition: all 0.3s;
}
.navbar {
padding: 15px 10px;
background: #fff;
border: none;
border-radius: 0.5rem;
margin-bottom: 40px;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.navbar-brand {
font-family: 'Georgia', serif;
color: #0056b3;
}
#sidebarCollapse {
border: none;
background: transparent;
color: #007BFF;
font-size: 1.5rem;
}
#sidebarCollapse:hover {
color: #0056b3;
}
/* Dashboard Widgets */
.card {
border-radius: 0.5rem;
border: none;
box-shadow: 0 4px 15px rgba(0,0,0,0.07);
transition: transform 0.2s;
}
.card:hover {
transform: translateY(-5px);
}
.card-header {
background: linear-gradient(45deg, rgba(0, 123, 255, 0.05), rgba(0, 123, 255, 0));
font-family: 'Georgia', serif;
font-weight: bold;
border-bottom: 1px solid #e9ecef;
}
/* Login Page Styles */
.login-container {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
.login-wrapper {
width: 100%;
max-width: 400px;
padding: 40px;
background: #FFFFFF;
border-radius: 0.5rem;
box-shadow: 0 4px 25px rgba(0,0,0,0.1);
}
.login-wrapper h2 {
text-align: center;
margin-bottom: 1.5rem;
color: #0056b3;
}
.form-control {
border-radius: 0.25rem;
padding: 0.75rem 1rem;
}
.btn-primary {
background-color: #007BFF;
border-color: #007BFF;
border-radius: 0.25rem;
padding: 0.75rem;
font-weight: bold;
transition: background-color 0.2s, box-shadow 0.2s;
}
.btn-primary:hover {
background-color: #0056b3;
border-color: #0056b3;
box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}
/* Feather Icons */
i.feather {
width: 18px;
height: 18px;
stroke-width: 2;
vertical-align: text-bottom;
margin-right: 10px;
}

12
assets/js/main.js Normal file
View File

@ -0,0 +1,12 @@
// Main javascript file
document.addEventListener("DOMContentLoaded", function() {
const sidebarCollapse = document.getElementById('sidebarCollapse');
const sidebar = document.getElementById('sidebar');
if (sidebarCollapse) {
sidebarCollapse.addEventListener('click', function () {
sidebar.classList.toggle('active');
});
}
});

8
auth.php Normal file
View File

@ -0,0 +1,8 @@
<?php
session_start();
if (!isset($_SESSION['user'])) {
header('Location: login.php');
exit();
}
?>

20
billing.php Normal file
View File

@ -0,0 +1,20 @@
<?php
require_once 'auth.php';
$page_title = 'Billing';
require_once 'partials/header.php';
?>
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3 mb-0 text-gray-800"><?php echo htmlspecialchars($page_title); ?></h1>
<a href="index.php" class="btn btn-secondary">
<i data-feather="arrow-left" class="mr-2"></i>Kembali ke Dashboard
</a>
</div>
<p>Billing page content goes here.</p>
</div>
<?php require_once 'partials/footer.php'; ?>

View File

@ -5,6 +5,47 @@ define('DB_NAME', 'app_30953');
define('DB_USER', 'app_30953'); define('DB_USER', 'app_30953');
define('DB_PASS', 'e45f2778-db1f-450c-99c6-29efb4601472'); define('DB_PASS', 'e45f2778-db1f-450c-99c6-29efb4601472');
// --- Encryption Settings ---
// WARNING: Changing this key will make all existing encrypted data unreadable.
// For production, use a key from a secure source like an environment variable.
define('ENCRYPTION_KEY', 'def0000068fcf8f7483bde1c8a45b53289f734814842116f7238e4375290654f27a845b20d3435324d83a335e86c45000a7649364e4358612743677d6a336e3c');
define('ENCRYPTION_CIPHER', 'aes-256-cbc');
/**
* Encrypts a string.
*
* @param string $plaintext The string to encrypt.
* @return string The encrypted string (base64 encoded).
*/
function encrypt($plaintext) {
$ivlen = openssl_cipher_iv_length(ENCRYPTION_CIPHER);
$iv = openssl_random_pseudo_bytes($ivlen);
$ciphertext_raw = openssl_encrypt($plaintext, ENCRYPTION_CIPHER, ENCRYPTION_KEY, OPENSSL_RAW_DATA, $iv);
$hmac = hash_hmac('sha256', $ciphertext_raw, ENCRYPTION_KEY, true);
return base64_encode($iv . $hmac . $ciphertext_raw);
}
/**
* Decrypts a string.
*
* @param string $ciphertext_base64 The base64 encoded ciphertext.
* @return string|false The decrypted string, or false on failure.
*/
function decrypt($ciphertext_base64) {
$c = base64_decode($ciphertext_base64);
$ivlen = openssl_cipher_iv_length(ENCRYPTION_CIPHER);
$iv = substr($c, 0, $ivlen);
$hmac = substr($c, $ivlen, 32);
$ciphertext_raw = substr($c, $ivlen + 32);
$original_plaintext = openssl_decrypt($ciphertext_raw, ENCRYPTION_CIPHER, ENCRYPTION_KEY, OPENSSL_RAW_DATA, $iv);
$calcmac = hash_hmac('sha256', $ciphertext_raw, ENCRYPTION_KEY, true);
if (hash_equals($hmac, $calcmac)) {
return $original_plaintext;
}
return false;
}
function db() { function db() {
static $pdo; static $pdo;
if (!$pdo) { if (!$pdo) {
@ -14,4 +55,4 @@ function db() {
]); ]);
} }
return $pdo; return $pdo;
} }

47
db/migrate.php Normal file
View File

@ -0,0 +1,47 @@
<?php
require_once __DIR__ . '/config.php';
try {
// Connect to MySQL server without specifying a database
$pdo = new PDO('mysql:host='.DB_HOST, DB_USER, DB_PASS, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
]);
// Create the database if it doesn't exist
$pdo->exec("CREATE DATABASE IF NOT EXISTS " . DB_NAME . ";");
$pdo->exec("USE " . DB_NAME . ";");
echo "Database '" . DB_NAME . "' created or already exists.\n";
// Packages table
$pdo->exec("CREATE TABLE IF NOT EXISTS packages (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
price INT NOT NULL,
duration_days INT NOT NULL,
description TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=INNODB;");
echo "Migration successful: 'packages' table created or already exists.\n";
// Routers table
$pdo->exec("CREATE TABLE IF NOT EXISTS routers (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
ip_address VARCHAR(45) NOT NULL,
username VARCHAR(255) NOT NULL,
password TEXT NOT NULL, -- Encrypted
description TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY ip_address (ip_address)
) ENGINE=INNODB;");
echo "Migration successful: 'routers' table created or already exists.\n";
} catch (PDOException $e) {
die("Migration failed: " . $e->getMessage());
}

View File

@ -0,0 +1,214 @@
<?php
/**
* RouterOS API client implementation.
*
* @author Denis Basta
* @copyright 2008-2013 Denis Basta
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version 1.6
*/
class RouterosAPI
{
public $debug = false; // Show debug information
public $connected = false; // Connection status
public $port = 8728; // RouterOS API port
public $timeout = 3; // Connection timeout
public $attempts = 5; // Connection attempts
public $delay = 3; // Delay between connection attempts
private $socket; // Socket resource
private $error_no; // Error number
private $error_str; // Error string
/**
* Connect to RouterOS
*
* @param string $ip Hostname (IP or domain) of the RouterOS server
* @param string $login The RouterOS username
* @param string $password The RouterOS password
*
* @return boolean Connection status
*/
public function connect($ip, $login, $password)
{
for ($ATTEMPT = 1; $ATTEMPT <= $this->attempts; $ATTEMPT++) {
$this->connected = false;
$this->debug('Connection attempt #' . $ATTEMPT . ' to ' . $ip . ':' . $this->port . '...');
$this->socket = @fsockopen($ip, $this->port, $this->error_no, $this->error_str, $this->timeout);
if ($this->socket) {
socket_set_timeout($this->socket, $this->timeout);
$this->write('/login');
$RESPONSE = $this->read(false);
if (isset($RESPONSE[0]) && $RESPONSE[0] == '!done') {
if (preg_match_all('/[^=]+/i', $RESPONSE[1], $MATCHES)) {
if ($MATCHES[0][0] == 'ret' && strlen($MATCHES[0][1]) == 32) {
$this->write('/login', false);
$this->write('=name=' . $login, false);
$this->write('=response=00' . md5(chr(0) . $password . pack('H*', $MATCHES[0][1])));
$RESPONSE = $this->read(false);
if (isset($RESPONSE[0]) && $RESPONSE[0] == '!done') {
$this->connected = true;
break;
}
}
}
}
fclose($this->socket);
}
sleep($this->delay);
}
if ($this->connected) {
$this->debug('Connected successfully to ' . $ip . ':' . $this->port);
} else {
$this->debug('Error connecting to ' . $ip . ':' . $this->port);
}
return $this->connected;
}
/**
* Disconnect from RouterOS
*/
public function disconnect()
{
fclose($this->socket);
$this->connected = false;
$this->debug('Disconnected');
}
/**
* Parse response from RouterOS
*
* @param array $response Response data
*
* @return array Parsed data
*/
public function parseResponse($response)
{
if (is_array($response)) {
$PARSED = array();
$CURRENT = null;
$singlevalue = null;
foreach ($response as $x) {
if (in_array($x, array('!fatal', '!re', '!trap'))) {
if ($x == '!re') {
$CURRENT =& $PARSED[];
} else {
$CURRENT =& $PARSED[$x][];
}
} elseif ($x != '!done') {
if (preg_match_all('/[^=]+/i', $x, $MATCHES)) {
if ($MATCHES[0][0] == 'ret') {
$singlevalue = $MATCHES[0][1];
}
$CURRENT[$MATCHES[0][0]] = (isset($MATCHES[0][1]) ? $MATCHES[0][1] : '');
}
}
}
if (empty($PARSED) && !is_null($singlevalue)) {
$PARSED = $singlevalue;
}
return $PARSED;
} else {
return array();
}
}
/**
* Read data from RouterOS
*
* @param boolean $parse Parse the data?
*
* @return array Data array
*/
public function read($parse = true)
{
$RESPONSE = array();
$line = '';
while (true) {
$BYTE = fread($this->socket, 1);
$line .= $BYTE;
if ($BYTE == "\0") {
$RESPONSE[] = $line;
if (substr($line, -5) == "!done\0") {
break;
}
$line = '';
}
}
if ($parse) {
return $this->parseResponse($RESPONSE);
} else {
return $RESPONSE;
}
}
/**
* Write (send) data to RouterOS
*
* @param string $command A string with the command to send
* @param boolean $param2 If we are sending a command, or a parameter
*
* @return void
*/
public function write($command, $param2 = true)
{
if ($command) {
$data = explode("\n", $command);
foreach ($data as $com) {
$com = trim($com);
fwrite($this->socket, $this->encodeLength(strlen($com)) . $com);
$this->debug('<<< ' . $com);
}
if (gettype($param2) == 'integer') {
fwrite($this->socket, $this->encodeLength(strlen('.tag=' . $param2)) . '.tag=' . $param2 . "\0");
$this->debug('<<< .tag=' . $param2);
} elseif (gettype($param2) == 'boolean') {
fwrite($this->socket, ($param2 ? '' : "\0"));
}
}
}
/**
* Encode length of the string
*
* @param integer $length Length of the string
*
* @return string Encoded length
*/
private function encodeLength($length)
{
if ($length < 0x80) {
return chr($length);
}
if ($length < 0x4000) {
return chr(($length >> 8) | 0x80) . chr($length & 0xFF);
}
if ($length < 0x200000) {
return chr(($length >> 16) | 0xC0) . chr(($length >> 8) & 0xFF) . chr($length & 0xFF);
}
if ($length < 0x10000000) {
return chr(($length >> 24) | 0xE0) . chr(($length >> 16) & 0xFF) . chr(($length >> 8) & 0xFF) . chr($length & 0xFF);
}
return chr(0xF0) . chr(($length >> 24) & 0xFF) . chr(($length >> 16) & 0xFF) . chr(($length >> 8) & 0xFF) . chr($length & 0xFF);
}
/**
* Print debug information
*
* @param string $text Debug text
*
* @return void
*/
private function debug($text)
{
if ($this->debug) {
echo $text . "\n";
}
}
}

248
index.php
View File

@ -1,150 +1,104 @@
<?php <?php
declare(strict_types=1); require_once 'auth.php';
@ini_set('display_errors', '1'); require_once 'partials/header.php';
@error_reporting(E_ALL); ?>
@date_default_timezone_set('UTC');
<div class="wrapper">
<?php require_once 'partials/sidebar.php'; ?>
<!-- Page Content -->
<div id="content">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<button type="button" id="sidebarCollapse" class="btn btn-info">
<i data-feather="align-left"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i data-feather="user" class="me-2"></i><?php echo htmlspecialchars($_SESSION['user']['username']); ?> (<?php echo htmlspecialchars($_SESSION['user']['role']); ?>)
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="#">Profile</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<h2>Dashboard</h2>
<p>Welcome to your Mikrotik management dashboard. Here's a summary of your network.</p>
<div class="row g-4 mb-4">
<!-- Summary Widgets -->
<div class="col-md-6 col-lg-3">
<div class="card text-white bg-primary">
<div class="card-body">
<h5 class="card-title"><i data-feather="users" class="me-2"></i> Pelanggan Aktif</h5>
<p class="card-text fs-4">-</p>
</div>
</div>
</div>
<div class="col-md-6 col-lg-3">
<div class="card text-white bg-warning">
<div class="card-body">
<h5 class="card-title"><i data-feather="alert-triangle" class="me-2"></i> Pending Suspend</h5>
<p class="card-text fs-4">-</p>
</div>
</div>
</div>
<div class="col-md-6 col-lg-3">
<div class="card text-white bg-danger">
<div class="card-body">
<h5 class="card-title"><i data-feather="file-minus" class="me-2"></i> Tagihan Overdue</h5>
<p class="card-text fs-4">-</p>
</div>
</div>
</div>
<div class="col-md-6 col-lg-3">
<div class="card text-white bg-success">
<div class="card-body">
<h5 class="card-title"><i data-feather="dollar-sign" class="me-2"></i> Pendapatan Bulan Ini</h5>
<p class="card-text fs-4">-</p>
</div>
</div>
</div>
</div>
<div class="row g-4">
<div class="col-lg-8">
<div class="card">
<div class="card-header">
<i data-feather="activity" class="me-2"></i> Recent Activity / Log
</div>
<div class="card-body">
<p class="text-muted">Placeholder for recent activities...</p>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card">
<div class="card-header">
<i data-feather="zap" class="me-2"></i> Quick Actions
</div>
<div class="card-body">
<div class="d-grid gap-2">
<button class="btn btn-outline-primary"><i data-feather="file-plus" class="me-2"></i> Buat Voucher</button>
<button class="btn btn-outline-secondary"><i data-feather="user-plus" class="me-2"></i> Buat Akun PPPoE</button>
</div>
</div>
</div>
</div>
</div>
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New Style</title>
<?php
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<?php if ($projectDescription): ?>
<!-- Meta description -->
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
<!-- Open Graph meta tags -->
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<!-- Twitter meta tags -->
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<?php endif; ?>
<?php if ($projectImageUrl): ?>
<!-- Open Graph image -->
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<?php endif; ?>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% { background-position: 0% 0%; }
100% { background-position: 100% 100%; }
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}
.loader {
margin: 1.25rem auto 1.25rem;
width: 48px;
height: 48px;
border: 3px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.hint {
opacity: 0.9;
}
.sr-only {
position: absolute;
width: 1px; height: 1px;
padding: 0; margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap; border: 0;
}
h1 {
font-size: 3rem;
font-weight: 700;
margin: 0 0 1rem;
letter-spacing: -1px;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
}
code {
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
footer {
position: absolute;
bottom: 1rem;
font-size: 0.8rem;
opacity: 0.7;
}
</style>
</head>
<body>
<main>
<div class="card">
<h1>Analyzing your requirements and generating your website…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
</div>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will update automatically as the plan is implemented.</p>
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
</div> </div>
</main> </div>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC) <?php require_once 'partials/footer.php'; ?>
</footer>
</body>
</html>

62
login.php Normal file
View File

@ -0,0 +1,62 @@
<?php
session_start();
// If user is already logged in, redirect to dashboard
if (isset($_SESSION['user'])) {
header('Location: index.php');
exit();
}
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'] ?? '';
$password = $_POST['password'] ?? '';
// Hardcoded user credentials
$users = [
'admin' => ['password' => 'admin123', 'role' => 'Administrator'],
'user' => ['password' => 'user123', 'role' => 'Operator'],
];
if (isset($users[$username]) && $users[$username]['password'] === $password) {
$_SESSION['user'] = [
'username' => $username,
'role' => $users[$username]['role']
];
header('Location: index.php');
exit();
} else {
$error = 'Invalid username or password!';
}
}
require_once 'partials/header.php';
?>
<div class="login-container">
<div class="login-wrapper">
<h2>Mikrotik Manager</h2>
<p class="text-center text-muted mb-4">Please sign in to continue</p>
<?php if ($error): ?>
<div class="alert alert-danger" role="alert">
<?php echo htmlspecialchars($error); ?>
</div>
<?php endif; ?>
<form action="login.php" method="POST">
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" name="username" required autofocus>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<button type="submit" class="btn btn-primary w-100">Sign In</button>
</form>
</div>
</div>
<?php require_once 'partials/footer.php'; ?>

6
logout.php Normal file
View File

@ -0,0 +1,6 @@
<?php
session_start();
session_destroy();
header('Location: login.php');
exit();
?>

20
monitoring.php Normal file
View File

@ -0,0 +1,20 @@
<?php
require_once 'auth.php';
$page_title = 'Monitoring';
require_once 'partials/header.php';
?>
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3 mb-0 text-gray-800"><?php echo htmlspecialchars($page_title); ?></h1>
<a href="index.php" class="btn btn-secondary">
<i data-feather="arrow-left" class="mr-2"></i>Kembali ke Dashboard
</a>
</div>
<p>Monitoring page content goes here.</p>
</div>
<?php require_once 'partials/footer.php'; ?>

174
packages.php Normal file
View File

@ -0,0 +1,174 @@
<?php
require_once 'auth.php';
require_once 'db/config.php';
// Restrict access to Administrators
if ($_SESSION['user']['role'] !== 'Administrator') {
header('Location: index.php');
exit;
}
$pdo = db();
$feedback = [];
$edit_package = null;
// Handle Edit Request
if (isset($_GET['edit_id'])) {
$stmt = $pdo->prepare("SELECT * FROM packages WHERE id = ?");
$stmt->execute([$_GET['edit_id']]);
$edit_package = $stmt->fetch();
}
// Handle Delete Request
if (isset($_POST['delete_id'])) {
try {
$stmt = $pdo->prepare("DELETE FROM packages WHERE id = ?");
$stmt->execute([$_POST['delete_id']]);
$feedback = ['type' => 'success', 'message' => 'Paket berhasil dihapus.'];
} catch (PDOException $e) {
$feedback = ['type' => 'danger', 'message' => 'Gagal menghapus paket: ' . $e->getMessage()];
}
}
// Handle Add/Update Request
if (isset($_POST['save_package'])) {
$name = $_POST['name'];
$price = $_POST['price'];
$duration_days = $_POST['duration_days'];
$description = $_POST['description'];
$id = $_POST['id'];
// Basic validation
if (empty($name) || !is_numeric($price) || !is_numeric($duration_days)) {
$feedback = ['type' => 'danger', 'message' => 'Nama, Harga, dan Durasi harus diisi dengan benar.'];
} else {
try {
if (empty($id)) { // Add new
$stmt = $pdo->prepare("INSERT INTO packages (name, price, duration_days, description) VALUES (?, ?, ?, ?)");
$stmt->execute([$name, $price, $duration_days, $description]);
$feedback = ['type' => 'success', 'message' => 'Paket baru berhasil ditambahkan.'];
} else { // Update existing
$stmt = $pdo->prepare("UPDATE packages SET name = ?, price = ?, duration_days = ?, description = ? WHERE id = ?");
$stmt->execute([$name, $price, $duration_days, $description, $id]);
$feedback = ['type' => 'success', 'message' => 'Paket berhasil diperbarui.'];
// Redirect to clear edit state
header("Location: packages.php");
exit;
}
} catch (PDOException $e) {
$feedback = ['type' => 'danger', 'message' => 'Operasi gagal: ' . $e->getMessage()];
}
}
}
// Fetch all packages for display
$packages = $pdo->query("SELECT * FROM packages ORDER BY name ASC")->fetchAll();
$page_title = 'Paket Layanan';
require_once 'partials/header.php';
?>
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3 mb-0 text-gray-800"><?php echo htmlspecialchars($page_title); ?></h1>
<a href="index.php" class="btn btn-secondary">
<i data-feather="arrow-left" class="mr-2"></i>Kembali ke Dashboard
</a>
</div>
<?php if (!empty($feedback)): ?>
<div class="alert alert-<?php echo htmlspecialchars($feedback['type']); ?>">
<?php echo htmlspecialchars($feedback['message']); ?>
</div>
<?php endif; ?>
<!-- Add/Edit Form Card -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary"><?php echo $edit_package ? 'Edit Paket' : 'Tambah Paket Baru'; ?></h6>
</div>
<div class="card-body">
<form action="packages.php" method="POST">
<input type="hidden" name="id" value="<?php echo htmlspecialchars($edit_package['id'] ?? ''); ?>">
<div class="form-row">
<div class="form-group col-md-4">
<label for="name">Nama Paket</label>
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($edit_package['name'] ?? ''); ?>" required>
</div>
<div class="form-group col-md-2">
<label for="price">Harga (Rp)</label>
<input type="number" class="form-control" id="price" name="price" value="<?php echo htmlspecialchars($edit_package['price'] ?? ''); ?>" required>
</div>
<div class="form-group col-md-2">
<label for="duration_days">Durasi (Hari)</label>
<input type="number" class="form-control" id="duration_days" name="duration_days" value="<?php echo htmlspecialchars($edit_package['duration_days'] ?? ''); ?>" required>
</div>
</div>
<div class="form-group">
<label for="description">Deskripsi</label>
<textarea class="form-control" id="description" name="description" rows="2"><?php echo htmlspecialchars($edit_package['description'] ?? ''); ?></textarea>
</div>
<button type="submit" name="save_package" class="btn btn-primary">
<i data-feather="save" class="mr-2"></i>Simpan
</button>
<?php if ($edit_package): ?>
<a href="packages.php" class="btn btn-secondary">Batal</a>
<?php endif; ?>
</form>
</div>
</div>
<!-- Packages List Card -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Daftar Paket</h6>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Nama</th>
<th>Harga</th>
<th>Durasi</th>
<th>Deskripsi</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php if (empty($packages)): ?>
<tr>
<td colspan="5" class="text-center">Belum ada paket yang ditambahkan.</td>
</tr>
<?php else: ?>
<?php foreach ($packages as $pkg): ?>
<tr>
<td><?php echo htmlspecialchars($pkg['name']); ?></td>
<td>Rp <?php echo number_format($pkg['price'], 0, ',', '.'); ?></td>
<td><?php echo htmlspecialchars($pkg['duration_days']); ?> hari</td>
<td><?php echo htmlspecialchars($pkg['description']); ?></td>
<td>
<a href="packages.php?edit_id=<?php echo $pkg['id']; ?>" class="btn btn-sm btn-warning">
<i data-feather="edit-2"></i>
</a>
<form action="packages.php" method="POST" onsubmit="return confirm('Yakin ingin menghapus paket ini?');" class="d-inline">
<input type="hidden" name="delete_id" value="<?php echo $pkg['id']; ?>">
<button type="submit" class="btn btn-sm btn-danger">
<i data-feather="trash-2"></i>
</button>
</form>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php require_once 'partials/footer.php'; ?>

13
partials/footer.php Normal file
View File

@ -0,0 +1,13 @@
<!-- Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<!-- Custom JS -->
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
<script>
// Initialize Feather Icons
feather.replace();
</script>
</body>
</html>

33
partials/header.php Normal file
View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>managemen mikrotik</title>
<meta name="description" content="Aplikasi manajemen pelanggan Mikrotik terintegrasi dengan RouterOS API untuk kemudahan pengelolaan.">
<meta name="keywords" content="mikrotik, routeros, pppoe, hotspot, billing, voucher, manajemen pelanggan, isp, Built with Flatlogic Generator">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:title" content="managemen mikrotik">
<meta property="og:description" content="Aplikasi manajemen pelanggan Mikrotik terintegrasi dengan RouterOS API untuk kemudahan pengelolaan.">
<meta property="og:image" content="<?php echo isset($_SERVER['PROJECT_IMAGE_URL']) ? htmlspecialchars($_SERVER['PROJECT_IMAGE_URL']) : ''; ?>">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:title" content="managemen mikrotik">
<meta property="twitter:description" content="Aplikasi manajemen pelanggan Mikrotik terintegrasi dengan RouterOS API untuk kemudahan pengelolaan.">
<meta property="twitter:image" content="<?php echo isset($_SERVER['PROJECT_IMAGE_URL']) ? htmlspecialchars($_SERVER['PROJECT_IMAGE_URL']) : ''; ?>">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<!-- Feather Icons -->
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
</head>
<body>

49
partials/sidebar.php Normal file
View File

@ -0,0 +1,49 @@
<?php
$user_role = $_SESSION['user']['role'] ?? '';
$current_page = basename($_SERVER['PHP_SELF']);
?>
<nav id="sidebar">
<div class="sidebar-header">
<h3>Mikrotik CRM</h3>
</div>
<ul class="list-unstyled components">
<li class="<?php echo ($current_page == 'index.php') ? 'active' : ''; ?>">
<a href="index.php"><i data-feather="grid"></i> Dashboard</a>
</li>
<?php if ($user_role === 'Administrator'): ?>
<li class="<?php echo ($current_page == 'routers.php') ? 'active' : ''; ?>">
<a href="routers.php"><i data-feather="server"></i> Routers</a>
</li>
<li class="<?php echo ($current_page == 'packages.php') ? 'active' : ''; ?>">
<a href="packages.php"><i data-feather="package"></i> Paket Layanan</a>
</li>
<li class="<?php echo ($current_page == 'users.php') ? 'active' : ''; ?>">
<a href="users.php"><i data-feather="users"></i> Operators</a>
</li>
<li class="<?php echo ($current_page == 'settings.php') ? 'active' : ''; ?>">
<a href="settings.php"><i data-feather="settings"></i> Pengaturan</a>
</li>
<?php endif; ?>
<li class="<?php echo ($current_page == 'vouchers.php') ? 'active' : ''; ?>">
<a href="vouchers.php"><i data-feather="file-text"></i> Vouchers</a>
</li>
<li class="<?php echo ($current_page == 'accounts.php') ? 'active' : ''; ?>">
<a href="accounts.php"><i data-feather="user-plus"></i> Akun PPPoE/Hotspot</a>
</li>
<li class="<?php echo ($current_page == 'monitoring.php') ? 'active' : ''; ?>">
<a href="monitoring.php"><i data-feather="bar-chart-2"></i> Monitoring</a>
</li>
<li class="<?php echo ($current_page == 'billing.php') ? 'active' : ''; ?>">
<a href="billing.php"><i data-feather="dollar-sign"></i> Billing</a>
</li>
</ul>
<ul class="list-unstyled logout-link">
<li>
<a href="logout.php"><i data-feather="log-out"></i> Logout</a>
</li>
</ul>
</nav>

306
routers.php Normal file
View File

@ -0,0 +1,306 @@
<?php
require_once 'auth.php';
require_once 'db/config.php';
require_once 'includes/routeros_api.class.php';
// Restrict access to Administrators
if ($_SESSION['user']['role'] !== 'Administrator') {
header('Location: index.php');
exit;
}
$page_title = 'Routers';
$errors = [];
$success = '';
$API = new RouterosAPI();
$API->debug = false;
// Handle Test Connection (AJAX)
if (isset($_GET['action']) && $_GET['action'] == 'test_connection') {
header('Content-Type: application/json');
$id = $_GET['id'] ?? 0;
$stmt = db()->prepare("SELECT * FROM routers WHERE id = ?");
$stmt->execute([$id]);
$router = $stmt->fetch();
if ($router) {
$password = decrypt($router['password']);
if ($API->connect($router['ip_address'], $router['username'], $password)) {
$API->write('/system/resource/print');
$resource = $API->read();
$API->disconnect();
echo json_encode(['success' => true, 'message' => 'Connection successful!', 'data' => $resource[0]]);
} else {
echo json_encode(['success' => false, 'message' => 'Connection failed. Check IP, username, and password.']);
}
} else {
echo json_encode(['success' => false, 'message' => 'Router not found.']);
}
exit;
}
// Handle form submissions (Add/Edit)
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$id = $_POST['id'] ?? null;
$name = trim($_POST['name']);
$ip_address = trim($_POST['ip_address']);
$username = trim($_POST['username']);
$password = $_POST['password'];
$description = trim($_POST['description']);
if (empty($name)) $errors[] = 'Router name is required.';
if (empty($ip_address) || !filter_var($ip_address, FILTER_VALIDATE_IP)) $errors[] = 'A valid IP address is required.';
if (empty($username)) $errors[] = 'Username is required.';
if (empty($id) && empty($password)) $errors[] = 'Password is required for a new router.';
if (empty($errors)) {
if ($id) { // Update
if (!empty($password)) {
$encrypted_password = encrypt($password);
$stmt = db()->prepare("UPDATE routers SET name = ?, ip_address = ?, username = ?, password = ?, description = ? WHERE id = ?");
$stmt->execute([$name, $ip_address, $username, $encrypted_password, $description, $id]);
} else {
$stmt = db()->prepare("UPDATE routers SET name = ?, ip_address = ?, username = ?, description = ? WHERE id = ?");
$stmt->execute([$name, $ip_address, $username, $description, $id]);
}
$success = "Router updated successfully!";
} else { // Insert
$encrypted_password = encrypt($password);
$stmt = db()->prepare("INSERT INTO routers (name, ip_address, username, password, description) VALUES (?, ?, ?, ?, ?)");
try {
$stmt->execute([$name, $ip_address, $username, $encrypted_password, $description]);
$success = "Router added successfully!";
} catch (PDOException $e) {
if ($e->errorInfo[1] == 1062) { // Duplicate entry
$errors[] = "A router with this IP address already exists.";
} else {
$errors[] = "Database error: " . $e->getMessage();
}
}
}
}
}
// Handle Delete
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
$id = $_GET['id'] ?? 0;
$stmt = db()->prepare("DELETE FROM routers WHERE id = ?");
$stmt->execute([$id]);
header('Location: routers.php?deleted=true');
exit;
}
if(isset($_GET['deleted'])) {
$success = "Router deleted successfully!";
}
// Fetch all routers
$routers = db()->query("SELECT * FROM routers ORDER BY name ASC")->fetchAll();
// Fetch router for editing
$edit_router = null;
if (isset($_GET['action']) && $_GET['action'] == 'edit') {
$id = $_GET['id'] ?? 0;
$stmt = db()->prepare("SELECT * FROM routers WHERE id = ?");
$stmt->execute([$id]);
$edit_router = $stmt->fetch();
}
require_once 'partials/header.php';
?>
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center">
<h1 class="h3 mb-0 text-gray-800"><?php echo htmlspecialchars($page_title); ?></h1>
<a href="index.php" class="btn btn-secondary"><i data-feather="arrow-left" class="mr-1"></i> Kembali</a>
</div>
<hr>
<?php if (!empty($errors)):
foreach ($errors as $error):
?><div class="alert alert-danger"><p class="mb-0"><?php echo $error; ?></p></div><?php
endforeach;
endif; ?>
<?php if ($success):
?><div class="alert alert-success"><?php echo $success; ?></div><?php
endif; ?>
<div class="row">
<div class="col-md-4">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary"><?php echo $edit_router ? 'Edit Router' : 'Add New Router'; ?></h6>
</div>
<div class="card-body">
<form action="routers.php" method="POST">
<input type="hidden" name="id" value="<?php echo $edit_router['id'] ?? ''; ?>">
<div class="form-group">
<label for="name">Router Name</label>
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($edit_router['name'] ?? ''); ?>" required>
</div>
<div class="form-group">
<label for="ip_address">IP Address</label>
<input type="text" class="form-control" id="ip_address" name="ip_address" value="<?php echo htmlspecialchars($edit_router['ip_address'] ?? ''); ?>" required>
</div>
<div class="form-group">
<label for="username">Username</label>
<input type="text" class="form-control" id="username" name="username" value="<?php echo htmlspecialchars($edit_router['username'] ?? ''); ?>" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" name="password" <?php echo $edit_router ? '' : 'required'; ?> >
<?php if ($edit_router):
?><small class="form-text text-muted">Leave blank to keep the current password.</small><?php
endif; ?>
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea class="form-control" id="description" name="description" rows="3"><?php echo htmlspecialchars($edit_router['description'] ?? ''); ?></textarea>
</div>
<button type="submit" class="btn btn-primary"><?php echo $edit_router ? 'Update Router' : 'Add Router'; ?></button>
<?php if ($edit_router):
?><a href="routers.php" class="btn btn-secondary">Cancel Edit</a><?php
endif; ?>
</form>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Router List</h6>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Name</th>
<th>IP Address</th>
<th>Username</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($routers as $router):
?><?php /* Check if $routers is empty before rendering rows */ if (!empty($routers)) { ?><?php // This check is redundant if the loop condition is correct, but kept for clarity if needed
?><tr >
<td><?php echo htmlspecialchars($router['name']); ?></td>
<td><?php echo htmlspecialchars($router['ip_address']); ?></td>
<td><?php echo htmlspecialchars($router['username']); ?></td>
<td>
<button class="btn btn-info btn-sm test-connection" data-id="<?php echo $router['id']; ?>" title="Test Connection">
<i data-feather="zap"></i>
</button>
<a href="routers.php?action=edit&id=<?php echo $router['id']; ?>" class="btn btn-warning btn-sm" title="Edit">
<i data-feather="edit-2"></i>
</a>
<a href="#" class="btn btn-danger btn-sm delete-router" data-id="<?php echo $router['id']; ?>" title="Delete">
<i data-feather="trash-2"></i>
</a>
</td>
</tr><?php } ?><?php endforeach; ?>
<?php if (empty($routers)):
?><td colspan="4" class="text-center">No routers found. Add one to get started.</td><?php
endif; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Delete Confirmation Modal -->
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Confirm Delete</h5>
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<div class="modal-body">
<p>Are you sure you want to delete this router?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<a href="#" id="confirmDelete" class="btn btn-danger">Delete</a>
</div>
</div>
</div>
</div>
<!-- Test Connection Modal -->
<div class="modal fade" id="testResultModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Connection Test Result</h5>
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<div class="modal-body" id="testResultBody">
<!-- Result will be injected here -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<?php require_once 'partials/footer.php'; ?>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Delete modal
const deleteButtons = document.querySelectorAll('.delete-router');
const confirmDelete = document.getElementById('confirmDelete');
deleteButtons.forEach(button => {
button.addEventListener('click', function(e) {
e.preventDefault();
const id = this.dataset.id;
confirmDelete.href = `routers.php?action=delete&id=${id}`;
new bootstrap.Modal(document.getElementById('deleteModal')).show();
});
});
// Test connection
const testButtons = document.querySelectorAll('.test-connection');
const testResultBody = document.getElementById('testResultBody');
const testResultModal = new bootstrap.Modal(document.getElementById('testResultModal'));
testButtons.forEach(button => {
button.addEventListener('click', function() {
const id = this.dataset.id;
testResultBody.innerHTML = '<p>Testing connection...</p>';
testResultModal.show();
fetch(`routers.php?action=test_connection&id=${id}`)
.then(response => response.json())
.then(data => {
let content = `<h6>${data.message}</h6>`;
if (data.success && data.data) {
content += '<pre class="bg-light p-2 rounded"><code class="json">';
content += `Board Name: ${data.data['board-name']}\n`;
content += `Version: ${data.data['version']}\n`;
content += `Uptime: ${data.data['uptime']}`;
content += '</code></pre>';
}
testResultBody.innerHTML = content;
})
.catch(error => {
testResultBody.innerHTML = '<p class="text-danger">An error occurred while testing the connection.</p>';
console.error('Error:', error);
});
});
});
});
</script>

26
settings.php Normal file
View File

@ -0,0 +1,26 @@
<?php
require_once 'auth.php';
// Restrict access to Administrators
if ($_SESSION['user']['role'] !== 'Administrator') {
header('Location: index.php');
exit;
}
$page_title = 'Pengaturan';
require_once 'partials/header.php';
?>
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3 mb-0 text-gray-800"><?php echo htmlspecialchars($page_title); ?></h1>
<a href="index.php" class="btn btn-secondary">
<i data-feather="arrow-left" class="mr-2"></i>Kembali ke Dashboard
</a>
</div>
<p>Settings page content goes here.</p>
</div>
<?php require_once 'partials/footer.php'; ?>

30
users.php Normal file
View File

@ -0,0 +1,30 @@
<?php
require_once 'auth.php';
// Restrict access to Administrators
if ($_SESSION['user']['role'] !== 'Administrator') {
header('Location: index.php');
exit;
}
$page_title = 'Operators';
require_once 'partials/header.php';
?>
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center">
<h1 class="h3 mb-0 text-gray-800"><?php echo htmlspecialchars($page_title); ?></h1>
<div>
<a href="index.php" class="btn btn-secondary mr-2">
<i data-feather="arrow-left" class="mr-1"></i> Kembali
</a>
<button class="btn btn-primary"><i data-feather="plus" class="mr-2"></i>Add Operator</button>
</div>
</div>
<hr>
<p>Operator management page content goes here.</p>
</div>
<?php require_once 'partials/footer.php'; ?>

23
vouchers.php Normal file
View File

@ -0,0 +1,23 @@
<?php
require_once 'auth.php';
$page_title = 'Vouchers';
require_once 'partials/header.php';
?>
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center">
<h1 class="h3 mb-0 text-gray-800"><?php echo htmlspecialchars($page_title); ?></h1>
<div>
<a href="index.php" class="btn btn-secondary mr-2">
<i data-feather="arrow-left" class="mr-1"></i> Kembali
</a>
<button class="btn btn-primary"><i data-feather="plus" class="mr-2"></i>Create Voucher</button>
</div>
</div>
<hr>
<p>Voucher management page content goes here.</p>
</div>
<?php require_once 'partials/footer.php'; ?>