Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require ($_SERVER['DOCUMENT_ROOT'] . '/assets/includes/inc.init.php');
- $username = $_GET['username'];
- $password = hash('sha256', $_GET['password']);
- echo $ecom->userManagement->doLogin($username, $password) == null;
- Fatal error: Cannot declare class Ecom, because the name is already in use in /var/www/html/core/class.ecom.php on line 19
- <?php
- ini_set('display_errors', 1);
- error_reporting(E_ALL);
- date_default_timezone_set("UTC");
- //TODO: Check Session
- $config = parse_ini_file('config.ini');
- $mysqli = new mysqli($config['db_host'], $config['db_user'], $config['db_password'], $config['db_name']);
- /* check connection */
- if ($mysqli->connect_errno) {
- printf("Connect failed: %sn", $mysqli->connect_error);
- exit();
- }
- require($_SERVER['DOCUMENT_ROOT'] . '/core/class.ecom.php');
- $ecom = new Ecom($mysqli);
- //TODO: Move the creation to when an item is added.
- $cart = null;
- if(isset($_COOKIE['cart_key'])) {
- $cart = $ecom->cartManagement->getCart($_COOKIE['cart_key']);
- if(!$cart->check()) {
- $cart->delete();
- $cart = $ecom->cartManagement->create($_SERVER['REMOTE_ADDR']);
- setcookie('cart_key', $cart->key, time()+60*60*24*365, '/', 'domain.com');
- }
- } else {
- $cart = $ecom->cartManagement->create($_SERVER['REMOTE_ADDR']);
- setcookie('cart_key', $cart->key, time()+60*60*24*365, '/', 'domain.com');
- }
- $cart->updateExpiration();
- ?>
- require($_SERVER['DOCUMENT_ROOT'] . '/core/class.ecom.php');
- $ecom = new Ecom($mysqli);
- <?php
- require ($_SERVER['DOCUMENT_ROOT'] . '/assets/includes/inc.init.php');
- $type = $_GET['type'];
- if($type == "add") {
- $cart->addItem($_GET['id']);
- }
- else if($type == "remove") {
- $cart->removeItem($_GET['id']);
- }
- else if($type == "update") {
- $cart->updateItems();
- }
- echo 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement