Ejemplo n.º 1
0
<?php

isset($_GET['id']) ? $edit = true : ($edit = false);
?>

<?php 
if ($_SERVER['REQUEST_METHOD'] && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $insert = array("group_name" => post_text_variable($_POST['group_name']), "group_code" => post_text_variable($_POST['group_code']));
    if (isset($_GET['id'])) {
        $db->where('id', $_GET['id']);
        $res = $db->update('groups', $insert);
        $action_msg = 'Group ' . $_POST['group_name'] . ' Updated!';
        $res ? $_SESSION['result'] = array('res' => 'gritter-success', 'msg' => $action_msg) : ($_SESSION['msg'] = array('res' => 'gritter-danger', 'msg' => 'Not updated! Please try again!'));
    } else {
        $res = $db->insert("groups", $insert);
        $action_msg = 'Group ' . $_POST['group_name'] . ' Added!';
        $res ? $_SESSION['result'] = array('res' => 'gritter-success', 'msg' => $action_msg) : ($_SESSION['msg'] = array('res' => 'gritter-danger', 'msg' => 'Not added! Please try again!'));
    }
    create_log_action($_SESSION['user_id'], $action_msg);
    echo '<meta http-equiv="refresh" content="0;url=' . BASEURL . 'customer/groups">';
} else {
    if (isset($_SESSION['result']) && $_SESSION['result'] != '') {
        check_for_notifications($_SESSION['result']['msg'], $_SESSION['result']['res']);
    }
    if ($edit) {
        $db->where("id", $_GET['id']);
        $groups = $db->getOne("groups");
    }
    $db->orderBy('id', 'ASC');
    $results = $db->get("groups");
    ?>
Ejemplo n.º 2
0
<?php

if ($_SERVER['REQUEST_METHOD'] && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $_POST['status'] == null ? $status = 1 : ($status = $_POST['status']);
    if (isset($_GET['id'])) {
        $db->where('id', $_GET['id']);
        $insert = array("card_name" => post_text_variable($_POST['card_name']), "card_code" => post_text_variable($_POST['card_code']), "group_code" => post_text_variable($_POST['group_code']), "region" => (int) $_POST['region'], "address" => post_text_variable($_POST['address']), "zip_code" => post_text_variable($_POST['zip_code']), "city" => post_text_variable($_POST['city']), "mail_address" => post_text_variable($_POST['mail_address']), "mail_zip_code" => post_text_variable($_POST['mail_zip_code']), "phone1" => post_text_variable($_POST['phone1']), "phone2" => post_text_variable($_POST['phone2']), "cellular" => post_text_variable($_POST['cellular']), "fax" => post_text_variable($_POST['fax']), "contact_person" => post_text_variable($_POST['contact_person']), "country" => post_text_variable($_POST['country']), "country_code" => post_text_variable($_POST['country_code']), "email" => post_text_variable($_POST['email']), "block" => post_text_variable($_POST['block']), "status" => $status);
        $res = $db->update('customer', $insert);
        $action_msg = 'Customer ' . $_POST['card_name'] . ' Updated!';
        $res ? $_SESSION['result'] = array('res' => 'gritter-success', 'msg' => $action_msg) : ($_SESSION['msg'] = array('res' => 'gritter-danger', 'msg' => 'Not updated! Please try again!'));
    } else {
        $res = $db->insert("customer", $insert);
        $insert = array("card_name" => post_text_variable($_POST['card_name']), "card_code" => post_text_variable($_POST['card_code']), "group_code" => post_text_variable($_POST['group_code']), "region" => (int) $_POST['region'], "address" => post_text_variable($_POST['address']), "zip_code" => post_text_variable($_POST['zip_code']), "city" => post_text_variable($_POST['city']), "mail_address" => post_text_variable($_POST['mail_address']), "mail_zip_code" => post_text_variable($_POST['mail_zip_code']), "phone1" => post_text_variable($_POST['phone1']), "phone2" => post_text_variable($_POST['phone2']), "cellular" => post_text_variable($_POST['cellular']), "fax" => post_text_variable($_POST['fax']), "contact_person" => post_text_variable($_POST['contact_person']), "country" => post_text_variable($_POST['country']), "country_code" => post_text_variable($_POST['country_code']), "email" => post_text_variable($_POST['email']), "block" => post_text_variable($_POST['block']), "status" => $status, "date_created" => date("Y-m-d H:i:s"));
        $action_msg = 'Customer ' . $_POST['card_name'] . ' Added!';
        $res ? $_SESSION['result'] = array('res' => 'gritter-success', 'msg' => $action_msg) : ($_SESSION['msg'] = array('res' => 'gritter-danger', 'msg' => 'Not added! Please try again!'));
    }
    create_log_action($_SESSION['user_id'], $action_msg);
    echo '<meta http-equiv="refresh" content="0;url=' . BASEURL . 'customer/search">';
}
Ejemplo n.º 3
0
<?php

isset($_GET['id']) ? $edit = true : ($edit = false);
?>

<?php 
if ($_SERVER['REQUEST_METHOD'] && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $insert = array("title" => post_text_variable($_POST['title']));
    if (isset($_GET['id'])) {
        $db->where('id', $_GET['id']);
        $res = $db->update('product_supplier', $insert);
        $action_msg = 'Product Supplier ' . $_POST['title'] . 'Updated!';
        $res ? $_SESSION['result'] = array('res' => 'gritter-success', 'msg' => $action_msg) : ($_SESSION['msg'] = array('res' => 'gritter-danger', 'msg' => 'Not updated! Please try again!'));
    } else {
        $res = $db->insert("product_supplier", $insert);
        $action_msg = 'Product Supplier ' . $_POST['title'] . ' Added!';
        $res ? $_SESSION['result'] = array('res' => 'gritter-success', 'msg' => $action_msg) : ($_SESSION['msg'] = array('res' => 'gritter-danger', 'msg' => 'Not added! Please try again!'));
    }
    create_log_action($_SESSION['user_id'], $action_msg);
    echo '<meta http-equiv="refresh" content="0;url=' . BASEURL . 'product/suppliers">';
} else {
    if (isset($_SESSION['result']) && $_SESSION['result'] != '') {
        check_for_notifications($_SESSION['result']['msg'], $_SESSION['result']['res']);
    }
    if ($edit) {
        $db->where("id", $_GET['id']);
        $supplier = $db->getOne("product_supplier");
    }
    $db->orderBy('id', 'ASC');
    $results = $db->get("product_supplier");
    ?>
Ejemplo n.º 4
0
<?php

if ($_SERVER['REQUEST_METHOD'] && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $_POST['status'] == null ? $status = 1 : ($status = $_POST['status']);
    $insert = array("item_code" => post_text_variable($_POST['item_code']), "barcode" => post_text_variable($_POST['barcode']), "description" => post_text_variable($_POST['description']), "supplier" => (int) $_POST['supplier'], "category" => (int) $_POST['category'], "wsale" => post_text_variable($_POST['wsale']), "retail" => post_text_variable($_POST['retail']), "vat" => post_text_variable($_POST['vat']), "status" => $status, "date_created" => date("Y-m-d H:i:s"));
    if (isset($_GET['id'])) {
        $db->where('id', $_GET['id']);
        $res = $db->update('product', $insert);
        $action_msg = 'Product ' . $_POST['description'] . ' Updated!';
        $res ? $_SESSION['result'] = array('res' => 'gritter-success', 'msg' => $action_msg) : ($_SESSION['msg'] = array('res' => 'gritter-danger', 'msg' => 'Not updated! Please try again!'));
    } else {
        $res = $db->insert("product", $insert);
        $action_msg = 'Product ' . $_POST['description'] . ' Added!';
        $res ? $_SESSION['result'] = array('res' => 'gritter-success', 'msg' => $action_msg) : ($_SESSION['msg'] = array('res' => 'gritter-danger', 'msg' => 'Not added! Please try again!'));
    }
    create_log_action($_SESSION['user_id'], $action_msg);
    echo '<meta http-equiv="refresh" content="0;url=' . BASEURL . 'product/search">';
}
Ejemplo n.º 5
0
<?php

error_reporting(E_ALL);
session_start();
include_once 'classes/class.mysqli.php';
include_once 'includes/required.inc.php';
require_once 'classes/class.encryption.php';
include_once 'classes/class.user.php';
$user = new User();
if ($user->get_session()) {
    echo '<meta http-equiv="refresh" content="0;url=' . BASEURL . '">';
}
if ($_SERVER['REQUEST_METHOD'] && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $login = $user->check_login(post_text_variable($_POST['username']), post_text_variable($_POST['password']));
    if ($login) {
        // Registration Success
        echo '<meta http-equiv="refresh" content="0;url=' . BASEURL . '">';
        //echo"logged in";
    } else {
        // Registration Failed
        echo '<div align="center" style="color: red; font-size: 12px; position: relative; top: 80px;">Username or Password is Wrong</div>';
    }
} else {
    ?>
	<!DOCTYPE html>
	<html lang="en">
	  <head>
	    <meta charset="utf-8">
	    <title>Login</title>
	    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	    <meta name="description" content="">
Ejemplo n.º 6
0
<?php

if ($_SERVER['REQUEST_METHOD'] && $_SERVER['REQUEST_METHOD'] == 'POST') {
    !isset($_POST['status']) ? $status = 1 : ($status = $_POST['status']);
    $encryption = new Encryption();
    if (isset($_GET['id'])) {
        $insert = array("name" => post_text_variable($_POST['name']), "lastname" => post_text_variable($_POST['lastname']), "email" => post_text_variable($_POST['email']), "username" => post_text_variable($_POST['username']), "backend_login" => $_POST['backend_login'], "status" => $status, "date_created" => date("Y-m-d H:i:s"));
        $db->where('id', $_GET['id']);
        $res = $db->update('users', $insert);
        $action_msg = 'User <b>' . $_POST['name'] . '</b>  Updated!';
        $res ? $_SESSION['result'] = array('res' => 'gritter-success', 'msg' => $action_msg) : ($_SESSION['msg'] = array('res' => 'gritter-danger', 'msg' => 'Not updated! Please try again!'));
    } else {
        $password = $encryption->encode($_POST['password']);
        $insert = array("name" => post_text_variable($_POST['name']), "lastname" => post_text_variable($_POST['lastname']), "email" => post_text_variable($_POST['email']), "username" => post_text_variable($_POST['username']), "password" => $password, "backend_login" => $_POST['backend_login'], "status" => '1', "date_created" => date("Y-m-d H:i:s"));
        $res = $db->insert("users", $insert);
        $action_msg = 'User <b>' . $_POST['name'] . '</b>  Added!';
        $res ? $_SESSION['result'] = array('res' => 'gritter-success', 'msg' => $action_msg) : ($_SESSION['msg'] = array('res' => 'gritter-danger', 'msg' => 'Not added! Please try again!'));
    }
    create_log_action($_SESSION['user_id'], $action_msg);
    echo '<meta http-equiv="refresh" content="0;url=' . BASEURL . 'user/search">';
}