Example #1
0
<?php

session_start();
include 'protected/config/db_config.php';
include 'protected/config/html_config.php';
include 'protected/library/validation_library.php';
include 'protected/controllers/login.php';
$db = new db_config();
$formelem = new FormElem();
$loginController = new LoginController();
$connect = $db->connect();
if ($_SESSION['session_is_admin'] == 1) {
    header("Location: /user/index.php?redirected=true");
} elseif ($_SESSION['session_is_admin'] == 0) {
}
if (isset($_POST['btn-login'])) {
    $username = $_POST['form-username'];
    $password = $_POST['form-password'];
    $loginController->loginPage($username, $password, $connect);
}
?>

<!DOCTYPE html>
<html lang="en">

    <head>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Zaril Login Form</title>
Example #2
0
<?php

session_start();
include 'protected/config/db_config.php';
include 'protected/config/html_config.php';
include 'protected/library/validation_library.php';
include 'protected/controllers/index.php';
include 'protected/models/transaction-items-display.php';
$db = new db_config();
$formelem = new FormElem();
$transactionItemsModel = new TransactionItemsModel();
$connect = $db->connect();
$brand_name = $_SESSION['brand_name'];
if (isset($_POST['btn-finish'])) {
    $sales_transaction_id = "ST" . rand(0, 100) . date("ymds");
    $subtotal = $_POST['subtotal'];
    $sales_tax = $_POST['total_sales_tax'];
    $total_amount = $_POST['total_amount'];
    $amount_given = $_POST['amount_given'];
    $change_amount = $_POST['change_amount'];
    $transaction_date = date("Y-m-d H:i:s");
    $brand_name_item = $_POST['brand_name'];
    $item_code = $_POST['item_code'];
    $item_description = $_POST['description'];
    $price = $_POST['price'];
    $sales_tax_amount = $_POST['sales_tax'];
    $total_sales_price = $_POST['total'];
    $transaction_date = date("Y-m-d H:i:s");
    $sales_transaction_report_sql = "INSERT INTO tbl_sales_trans_report (sales_transaction_id, subtotal, sales_tax_total, total_amount, amount_given, change_amount, transaction_date) VALUES ('" . $sales_transaction_id . "', '" . $subtotal . "', '" . $sales_tax . "', '" . $total_amount . "', '" . $amount_given . "', '" . $change_amount . "', '" . $transaction_date . "')";
    $sales_transaction_report_query = mysqli_query($connect, $sales_transaction_report_sql) or die(mysqli_error($connect));
    //echo $sales_transaction_report_sql;
Example #3
0
<?php

session_start();
include 'protected/config/db_config.php';
include 'protected/config/html_config.php';
include 'protected/library/validation_library.php';
include 'protected/models/users.php';
$db = new db_config();
$formelem = new FormElem();
$UsersModel = new UsersModel();
$connect = $db->connect();
$brand_name = $_SESSION['brand_name'];
if (isset($_POST['btn-create'])) {
    $data['email'] = $_POST['email'];
    $data['username'] = $_POST['username'];
    $data['brand_name'] = $_POST['brandname'];
    $data['password'] = $_POST['password'];
    $data['backup_password'] = $_POST['password'];
    $data['is_admin'] = $_POST['isAdmin'];
    $data['date_created'] = date("Y-m-d H:i:s");
    $db->mquery_insert("tbl_users", $data, $connect);
}
if (isset($_POST['update-record'])) {
    $id = $_POST['id'];
    $email = $_POST['email'];
    $username = $_POST['username'];
    $brandname = $_POST['brandname'];
    $is_admin = $_POST['isadmin'];
    $user_item_update_sql = "UPDATE tbl_users SET id = '" . $id . "', email = '" . $email . "', username = '******', brand_name = '" . $brandname . "' WHERE id = '" . $id . "'";
    $user_item_update = mysqli_query($connect, $user_item_update_sql) or die(mysqli_error($connect));
    header('location: /user.php?record_updated=true');
Example #4
0
<?php

session_start();
include '../protected/config/db_config.php';
include '../protected/config/html_config.php';
include '../protected/library/validation_library.php';
$db = new db_config();
$formelem = new FormElem();
$connect = $db->connect();
if (isset($_POST['btn-create'])) {
    $data['email'] = $_POST['email'];
    $data['username'] = $_POST['username'];
    $data['brand_name'] = $_POST['brandname'];
    $data['password'] = $_POST['password'];
    $data['is_admin'] = $_POST['isAdmin'];
    $data['date_created'] = date("Y-m-d H:i:s");
    $db->mquery_insert("tbl_users", $data, $connect);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Create User</title>
</head>

<body>

<?php 
echo $formelem->create(array('method' => 'post', 'class' => '', 'id' => 'createUser'));
?>
Example #5
0
<?php

session_start();
include 'protected/config/db_config.php';
include 'protected/config/html_config.php';
include 'protected/library/validation_library.php';
include 'protected/controllers/index.php';
include 'protected/models/delivery-admin.php';
$db = new db_config();
$formelem = new FormElem();
$deliveryModel = new DeliveryModel();
$connect = $db->connect();
if (isset($_POST['btn-save'])) {
    $delivery_report_id = $_POST['delivery_report_id'];
    $status = $_POST['status'];
    //$quantity_received = $_POST['quantity_received'];
    $timestamp = date("Y-m-d H:i");
    //$_POST['currentTimeDate'];
    $get_quantity_sql = "SELECT SUM(quantity_received) FROM tbl_deliveries WHERE delivery_report_id = '" . $delivery_report_id . "'";
    $get_quantity_result = mysqli_query($connect, $get_quantity_sql);
    while ($row = mysqli_fetch_array($get_quantity_result)) {
        $quantity_received = $row['SUM(quantity_received)'];
    }
    $update_delivery_report_sql = "UPDATE tbl_delivery_report SET delivery_status = '" . $status . "', quantity_received = '" . $quantity_received . "', date_accepted = '" . $timestamp . "' WHERE delivery_report_id = '" . $delivery_report_id . "'";
    $delivery_report_query = mysqli_query($connect, $update_delivery_report_sql) or die(mysqli_error($connect));
    $update_deliveries_sql = "UPDATE tbl_deliveries SET delivery_status = '" . $status . "', date_accepted = '" . $timestamp . "' WHERE delivery_report_id = '" . $delivery_report_id . "'";
    $deliver_query = mysqli_query($connect, $update_deliveries_sql) or die(mysqli_error($connect));
    header('location: /delivery.php?report_status_updated=true');
}
?>
<!DOCTYPE html>
Example #6
0
<?php

session_start();
include '../protected/config/db_config.php';
include '../protected/config/html_config.php';
include '../protected/library/validation_library.php';
include '../protected/controllers/index.php';
include '../protected/models/delivery.php';
$db = new db_config();
$formelem = new FormElem();
$deliveryModel = new DeliveryModel();
$connect = $db->connect();
$brand_name = $_SESSION['brand_name'];
$id = $_SESSION['id'];
$tax_percentage = 3;
if ($_SESSION['session_userid'] == '') {
    header("Location: /login.php?loggedin=false");
}
if (isset($_POST['change-password'])) {
    $id = $_POST['id'];
    $password = $_POST['new-password'];
    $user_update_sql = "UPDATE tbl_users SET password = '******' WHERE id = '" . $id . "'";
    $user_update = mysqli_query($connect, $user_update_sql) or die(mysqli_error($connect));
    header('location: /logout.php');
}
if (isset($_POST['btn-row'])) {
    $delivery_report_id = "DR" . rand(0, 100) . date("ymds");
    $status = 'not submitted';
    $date_created = date("Y-m-d H:i:s");
    $details = $_POST['product_details'];
    $item_code = $_POST['item_code'];