public function store() { $conn = mysql_connect("localhost", "root", "") or die("Cannot connect database."); $lnk = mysql_select_db("db_quantity") or die("Cannot select database."); $query = "INSERT INTO `db_quantity`.`tbl_quantity` (`id`, `week`, `date`, `manager`, `quantity`) VALUES ('" . $this->id . "', '" . $this->week . "', '.{$this->date}.', '" . $this->manager . "', '" . $this->quantity . "');"; $result = mysql_query($query); if ($result) { $_message = "All data is added successfully."; } else { $_message = "There is an error while saving data. Please try again later."; } Utility::redirect('../../index.php'); }
public function delete($id = null) { if (is_null($id)) { Utility::message("<div class=\"message_error\">No id avaiable. Sorry !</div>"); Utility::redirect('index.php'); } $conn = mysql_connect("localhost", "root", "") or die("Cannot connect database."); $lnk = mysql_select_db("atomicproject") or die("Cannot select database."); $query = "DELETE FROM `atomicproject`.`summary` WHERE `summary`.`id` = " . $id; $result = mysql_query($query); if ($result) { Utility::message("<div class=\"message_success\">Summary is deleted successfully.</div>"); } else { Utility::message("<div class=\"message_error\">Cannot delete.</div>"); } Utility::redirect('index.php'); }
<!-- Bootstrap --> <link href="../../css/bootstrap.min.css" rel="stylesheet"> <link href="../../css/style.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <h1 class="text-center">Summary</h1> <div class="wrapper"> <?php echo Utility::message(); ?> <div class="actionDiv"><span>Search / Filter </span> <span id="utility">Download as PDF | XL <a href="create.php">Add New</a></span> <select> <option>10</option> <option>20</option> <option>30</option> <option>40</option> <option>50</option> </select> </div> <table class="table table-bordered"> <thead> <tr> <th>SL</th>
use App\Connection\Connection; use App\Utility\Utility; use App\LoginRegistration\LoginRegistration; $dbConnect = new Connection(); // Utility::dd($dbConnect); $message = isset($dbConnect->message) ? $dbConnect->message : ""; ?> <?php if (isset($dbConnect) && $_SERVER["REQUEST_METHOD"] == "POST" && isset($_REQUEST["login"])) { if (!empty($_REQUEST["username"]) && !empty($_REQUEST["password"])) { $newUser = new LoginRegistration($_POST); $dbUser = $newUser->loginQuery(); if ($dbUser) { if ($dbUser["username"] == $newUser->username && password_verify($newUser->password, $dbUser["password"])) { Utility::redirect("welcome.php"); } else { $message = "Error...Username/Password doesn't match!"; } } else { $message = "Error...There is no user like this!"; } } else { $message = "Username/Password can't be empty"; } } ?> <!DOCTYPE html> <html lang="en-US"> <head> <meta charset="utf-8">
<!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php include_once "./vendor/autoload.php"; use App\Url\Bookmark; use App\Utility\Utility; $newbookmark = new Bookmark(); $newbookmark->title = $_POST['title']; $newbookmark->url = $_POST['url']; $newbookmark->store(); Utility::redirectbookmark(); ?> </body> </html>
<?php require_once '../vendor/autoload.php'; use App\Connection\Connection; use App\Utility\Utility; use App\Invoice\Invoice; $dbConnect = new Connection(); // Utility::dd($_POST); $message = isset($dbConnect->message) ? $dbConnect->message : ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $errors = array(); $errors = Utility::validateInput($_POST); if (empty($errors)) { $newInvoice = new Invoice($_POST); $message = $newInvoice->createInventory(); } else { $message = "There was an error while creating invoice"; } } ?> <!-- link include --> <?php include 'includes/all_link_body.php'; ?> <script type="text/javascript" src="js/jquery-1.11.2.min.js"></script> <script type="text/javascript"> function calc(){ q = parseInt(document.getElementById('change').value); p = parseInt(document.getElementById('price1').value);