Ejemplo n.º 1
0
<?php

ini_set('display_errors', 1);
include 'connection.php';
if ($_POST['method'] == "getOrders") {
    getOrders($_POST['json']);
    //call getOrders method
} elseif ($_POST['method'] == "addOrder") {
    addOrder($_POST['json']);
} elseif ($_POST['method'] == "searchItems") {
    searchItems($_POST['json']);
}
function getOrders($json)
{
    global $mysqli;
    //get params from json object
    $jsonObj = json_decode($json);
    $date = $jsonObj->{'date'};
    $style = $jsonObj->{'style'};
    $undate = strtotime($date);
    $year = date('Y', $undate);
    $month = date('m', $undate);
    $day = date('d', $undate);
    if ($style === "YEAR") {
        $strQuery = "SELECT * FROM orders WHERE (DATE Like '" . $year . "-%')";
        getSalesByQuery($strQuery);
    } elseif ($style === "MONTH") {
        $strQuery = "SELECT * FROM orders WHERE (DATE Like '" . $year . "-" . $month . "-%')";
        getSalesByQuery($strQuery);
    } elseif ($style === "DAY") {
        $strQuery = "SELECT * FROM orders WHERE (DATE = '" . $date . "' )";
Ejemplo n.º 2
0
    echo '<li ><a href=" ' . $slider[0]['link'] . '"><img src="' . $slider[0]['photo'] . '" alt="" /></a></li>';
    echo '</ul>
    </div>
</div>';
}
?>

<!-- End Content Slider -->

<!-- Products -->
<div class="products">
    <div class="cl">&nbsp;</div>
    <ul>
        <?php 
if ($isSearch) {
    $items = searchItems($_POST['keyword'], $_POST['category'], $_POST['price1'], $_POST['price2']);
} else {
    $items = getItems($id);
}
?>
        <?php 
$n = count($items);
$i = 0;
foreach ($items as $item) {
    echo '<li>';
    $catName = getCategoryById($item['id_category'])[0]['name'];
    $item['description'] = substr($item['description'], 0, 10);
    $i++;
    $link = '?type=3&id=' . $item['id'];
    echo '<a href="' . $link . '"><img src="' . $item['photo'] . '" alt="" /></a>
                <div class="product-info">
Ejemplo n.º 3
0
<?php 
include "./inc/footer.php";
?>

<script>
	var Games = <?php 
function ConnectToDB()
{
    $dbh = new PDO('<host>', '<user>', '<password>');
    return $dbh;
}
include "server/items.php";
$terms = isset($_GET['terms']) ? $_GET['terms'] : "";
$order = isset($_GET['order']) ? $_GET['order'] : 1;
$genre = isset($_GET['genre']) ? "%" . $_GET['genre'] . "%" : "%";
$arr = searchItems($terms, $order, $genre);
echo $arr;
?>
 
	;
	
	var Genres = <?php 
echo json_encode(getGenres());
?>
	//Games = JSON.parse(Games);
	
	function renderGameDiv(obj){
		var _div = $("<div />",{class:"search_game_cont row"});
		
		var _img = $("<img />",{src:obj.image_url});
		var _imgDiv = $("<div />",{class:"col-sm-3"});
Ejemplo n.º 4
0
<?php

require_once '../config.php';
isset($_REQUEST['action']) ? $action = $_REQUEST['action'] : printNoResults();
switch ($action) {
    // case "getItem":
    //     isset($_REQUEST['query']) ? $queryString = $_REQUEST['query'] : printNoResults();
    //     echo(json_encode(getItem($queryString)));
    //     break;
    case "searchItems":
        isset($_REQUEST['query']) ? $queryString = $_REQUEST['query'] : printNoResults();
        isset($_REQUEST['limit']) ? $limit = $_REQUEST['limit'] : ($limit = 5);
        isset($_REQUEST['showNoIconItems']) ? $showNoIconItems = $_REQUEST['showNoIconItems'] : ($showNoIconItems = false);
        $showNoIconItems == "true" ? $showNoIconItems = true : ($showNoIconItems = false);
        echo json_encode(searchItems($queryString, $limit, $showNoIconItems));
        break;
    case "spawnItemForUser":
        //This is not secure at the moment. Might need to consider moving it and other item administrative functions to their own file.
        isset($_REQUEST['userId']) ? $userId = $_REQUEST['userId'] : $printNoResults();
        isset($_REQUEST['itemId']) ? $itemId = $_REQUEST['itemId'] : printNoResults();
        isset($_REQUEST['ql']) ? $ql = $_REQUEST['ql'] : $printNoResults();
        echo json_encode(spawnItemforUser($userId, $itemId, $ql));
        break;
    case "getUsersInventory":
        isset($_REQUEST['query']) ? $queryString = $_REQUEST['query'] : printNoResults();
        echo json_encode(getUsersInventory($queryString));
        break;
}
die;
// `items`.`ContainerType`, `items`.`ContainerInstance`, `items`.`ContainerPlacement`, `items`.`LowId`, `items`.`HighId`, `items`.`Quality`, `items`.`MultipleCount`
function getUsersInventory($query)