public function isUser($email, $password) { $password = Login::string2hash($password); $sql = "SELECT * FROM `{$this->_table}`\n\t\t\t\tWHERE `email` = '" . $this->db->escape($email) . "'\n\t\t\t\tAND `password` = '" . $this->db->escape($password) . "'\n\t\t\t\tAND `active` = 1"; $result = $this->db->fetchOne($sql); if (!empty($result)) { $this->_id = $result['id']; return true; } return false; }
public function isUser($user = NULL, $password = NULL) { if (!empty($user) && !empty($password)) { $password = Login::string2hash($password); $sql = "SELECT * FROM `{$this->_table}`" . "WHERE `username` = '" . $this->db->escape($user) . "'" . " AND `password` = '" . $this->db->escape($password) . "'"; $result = $this->db->fetchOne($sql); if (!empty($result)) { echo 'disini'; $this->_user['id'] = $result['id']; $this->_user['first_name'] = $result['first_name']; $this->_user['last_name'] = $result['last_name']; $this->_user['level'] = $result['level']; $_SESSION['aid'] = $result['id']; $_SESSION['level'] = $result['level']; return TRUE; } return "failed"; } return false; }
<?php Login::restrictFront(); $token1 = mt_rand(); $token2 = Login::string2hash($token1); Session::setSession('token2', $token2); $objBasket = new Basket(); $out = array(); $session = Session::getSession('basket'); if (!empty($session)) { $objCatalogue = new Catalogue(); foreach ($session as $key => $value) { $out[$key] = $objCatalogue->getProduct($key); } } require_once "_header.php"; ?> <h1>Order summary</h1> <?php if (!empty($out)) { ?> <div id="big_basket"> <form action="" method="post" id="frm_basket"> <table cellpadding="0" cellspacing="0" border="0" class="tbl_repeat"> <tr>
public function format($key, $value) { switch ($value) { case 'password': $this->_post[$key] = Login::string2hash($this->_post[$key]); break; } }
<?php require_once '../inc/autoload.php'; // tokens $token2 = Session::getSession('token2'); $objForm = new Form(); $token1 = $objForm->getPost('token'); if ($token2 == Login::string2hash($token1)) { // create order $objOrder = new Order(); if ($objOrder->createOrder()) { // populate order details $order = $objOrder->getOrder(); $items = $objOrder->getOrderItems(); if (!empty($order) && !empty($items)) { $objBasket = new Basket(); $objCatalogue = new Catalogue(); $objPayPal = new PayPal(); foreach ($items as $item) { $product = $objCatalogue->getProduct($item['product']); $objPayPal->addProduct($item['product'], $product['name'], $item['price'], $item['qty']); } $objPayPal->_tax_cart = $objBasket->_vat; // populate client's details $objUser = new User(); $user = $objUser->getUser($order['client']); if (!empty($user)) { // get user country record $objCountry = new Country(); $country = $objCountry->getCountry($user['country']); // pass client's details to the PayPal instance