コード例 #1
0
ファイル: EditProduct.php プロジェクト: Mohamed-Ashour/MyCafe
						<form action="Logout.php" method="post" >
				            <input type="hidden" name="ss" value="any">
				            <button type="submit" class="add-user btn btn-default logout">Logout</button>
				        </form>
					</li>
				</ul>
		    </div>
		</div>
	</nav>

	<div class="container" id="wrapper">
		<?php 
require_once 'database/model.php';
$cat_db = new ORM();
$cat_db->setTable("categories");
$categories = $cat_db->select_all();
if (isset($_POST["product_name"])) {
    $key = 0;
    if (empty($_POST["product_name"])) {
        echo "<h4 class='alert-danger'> Product name is required</h4>";
        $key = 1;
    }
    if (empty($_POST["price"])) {
        echo "<h4 class='alert-danger'> Price is required</h4>";
        $key = 1;
    }
    if (empty($_POST["category"])) {
        echo "<h4 class='alert-danger'> Category is required</h4>";
        $key = 1;
    }
    if ($key == 0) {
コード例 #2
0
ファイル: Login.php プロジェクト: Mohamed-Ashour/MyCafe
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="css/bootstrap.min.css" rel="stylesheet">
	<link rel="stylesheet" href="css/style.css" charset="utf-8">
	<link rel="icon" href="images/favicon.ico" type="image/gif" sizes="32x32">
	<script src="js/jquery-2.2.0.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
</head>
<body>
	<div class="container">
		<?php 
session_start();
if ($_POST) {
    require_once 'database/model.php';
    $mydb = new ORM();
    $mydb->setTable("users");
    $users = $mydb->select_all();
    if (!empty($_POST["keep_logged"])) {
        while ($row = $users->fetch_assoc()) {
            if ($_POST['email'] == $row["email"] && hash("md5", $_POST['password']) == $row["password"] && $row["is_admin"]) {
                setcookie('user', 'admin', time() + 86400 * 30);
                setcookie('user_id', $row["id"], time() + 86400 * 30);
                header("Location: AdminHome.php");
            } elseif ($_POST['email'] == $row["email"] && hash("md5", $_POST['password']) == $row["password"]) {
                setcookie('user', $row["name"], time() + 86400 * 30);
                setcookie('user_id', $row["id"], time() + 86400 * 30);
                setcookie('user_pic', $row["pic"], time() + 86400 * 30);
                header("Location: UserOrder.php");
            }
        }
    } elseif (empty($_POST["keep_logged"])) {
        while ($row = $users->fetch_assoc()) {
コード例 #3
0
ファイル: Products.php プロジェクト: Mohamed-Ashour/MyCafe
    }
}
if (isset($_COOKIE['user'])) {
    if ($_COOKIE['user'] != "admin") {
        echo "You have no access to this page!";
        exit;
    }
}
require_once 'database/model.php';
$mydb = new ORM();
$mydb->setTable("products");
if ($_POST) {
    $where = array('id' => $_POST['id']);
    $mydb->delete($where);
}
$products = $mydb->select_all();
?>

	<nav class="navbar navbar-inverse navbar-static-top">
		<div class="container-fluid">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="AdminHome.php">MyCafe</a>
			</div>

			<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">