<a href="/../user/" class="btn btn-default">Users</a> <a href="/../user/AddUser.php" class="btn btn-default">Add User</a> <a href="/../products/index.php" class="btn btn-default">Products</a> <a href="/../products/AddProduct.php" class="btn btn-default">Add Product</a> <a href="/../orders/index.php" class="btn btn-default">Orders</a> </div> <?php if (isset($_POST['name']) && isset($_POST['price'])) { $product = new Product(); $product->setName($_POST['name']); $product->setPrice($_POST['price']); $date = new DateTime('now'); $product->setCreatedAt($date->getTimestamp()); $product_insert = new EntityManager(); $product_insert->insert($product); header("Location: index.php"); exit; } ?> <form method="post"> <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" id="name" placeholder="Name" name="name"> </div> <div class="form-group"> <label for="name">Price</label> <input type="text" class="form-control" id="name" placeholder="Name" name="price"> </div>
<a href="/../products/AddProduct.php" class="btn btn-default">Add Product</a> <a href="/../orders/index.php" class="btn btn-default">Orders</a> </div> <?php if (isset($_POST['name'])) { $user = new User(); $user->setUserName($_POST['name']); // $date = new DateTime('now'); $user->setCreatedAt(1111111111); // $user = array( // 'entity' => 'users', // 'user_name' => $_POST['name'] // ); $user_insert = new EntityManager(); $user_insert->insert($user); header("Location: index.php"); exit; } ?> <form method="post"> <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" id="name" placeholder="Name" name="name"> </div> <button type="submit" class="btn btn-default">Add</button> </form> </div>
integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"> </script> </head> <body class="add-user"> <div class="container"> <?php $entity = new EntityManager(); $entity->db_init(); if (isset($_POST['name'])) { $user_login = new User(); $user_login->setUserName($_POST['name']); $id = $entity->insert($user_login); $_SESSION['user'] = $id; header("Location: /user/index.php"); exit; } ?> <form method="post"> <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" id="name" placeholder="Name" name="name"> </div> <button type="submit" class="btn btn-default">Sign in</button> </form>
<?php require_once __DIR__ . '/../../config/autoload.php'; use Entity\EntityManager; use Order\Order; session_start(); if (isset($_GET['card']) && isset($_GET['confirm']) && $_GET['confirm'] == true && isset($_SESSION['add-to-card'])) { foreach ($_SESSION['add-to-card'] as $product_id) { $order = new Order(); $order->setUserId($_SESSION['user']); $order->setProductId($product_id); $add_order = new EntityManager(); $add_order->insert($order); } unset($_SESSION['add-to-card']); } ?> <html> <head> <title>Shop</title> <link rel="stylesheet" href="../css/style.css"> <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">