send_headers(); $orders = get_all_orders_by_uid($_GET['id']); echo json_encode($orders); } elseif ('orders' == $_GET['uri']) { send_headers(); $orders = get_all_orders(); echo json_encode($orders); } elseif ('swipes' == $_GET['uri'] && isset($input['uid']) && isset($input['service']) && isset($_GET['id'])) { if ($input['service'] == 1 && is_payment_reader($_GET['id'])) { // This is a payment request $owner = get_tag_owner($input['uid']); if ($owner && $input['order']) { $user = get_user_by_uid($owner); $input['order']['client'] = $user['uid']; $input['order']['reader'] = $_GET['id']; new_order($input['order']); // get the new user balance $user = get_user_by_uid($user['uid']); send_headers(); $response = array("version" => $version, "response" => "OK", "uid" => $user['uid'], "balance" => floatval($user['balance'])); echo json_encode($response); } else { forbidden(); } } elseif ($input['service'] == 0) { $owner = get_tag_owner($input['uid']); $permission = get_permission($owner, $_GET['id']); $end_date_reached = false; if ($permission['end']) { $end_date_reached = time() > strtotime($permission['end']); }
if ($i != $num) { $sql .= ", "; } } $sql .= ") VALUES ("; $i = 0; foreach ($_POST as $key => $val) { $i++; $sql .= "'" . $val . "'"; if ($i != $num) { $sql .= ", "; } } $sql .= ")"; db_mysql_query($sql, $conn); new_order(db_last_id($conn)); if ($action != 'add') { $id = db_last_id($conn); } } } ###### Inhalt aus datenbank auslesen wenn ID gesetzt und Datenaktualisiert wurden ###### if (isset($id)) { $sql = "SELECT * FROM " . $_SESSION['TABLE_PREFIX'] . $modul . " WHERE id = '" . $id . "' "; $result = db_mysql_query($sql, $conn); if (db_mysql_num_rows($result)) { foreach (db_mysql_fetch_array($result) as $key => $val) { ${$key} = $val; } } }
$sql .= ", "; } } $sql .= ") VALUES ("; $i = 0; foreach ($_POST as $key => $value) { $i++; $sql .= "'" . $value . "'"; if ($i != $num) { $sql .= ", "; } } $sql .= ")"; db_mysql_query($sql, $conn); $id = db_last_id($conn); new_order($id); if ($action == 'add') { unset($id); } } } ###### Inhalt aus datenbank auslesen wenn ID gesetzt und Datenaktualisiert wurden ###### if (isset($id)) { $sql = "SELECT * FROM " . $_SESSION['TABLE_PREFIX'] . $modul . " WHERE id = '" . $id . "' "; $result = db_mysql_query($sql, $conn); if (db_mysql_num_rows($result)) { foreach (db_mysql_fetch_array($result) as $key => $value) { ${$key} = $value; } } }
function new_transfer($receiver, $transfers, $values) { $user = get_user_by_uid($values['client']); $values['reader'] = intval($values['reader']); $amount = 0.0; $amount = intval($transfers) * 0.5; if ($user) { $swipe = add_swipe(0, $user['uid'], 3, 1); debit_account($user['uid'], $amount); add_payment($receiver, $amount); new_order($values); } }
function shortButton_action($uid, $snackId) { //needed to hide the menu $dashboard_active = true; $order = array(); $order['client'] = $uid; $order["snack_{$snackId}"] = 1; new_order($order); // Redirect browser header("Location: http://" . $_SERVER['SERVER_NAME'] . "/dashboard"); exit; }
function soda_order_action($uid) { $order = array(); $order['client'] = $uid; $order['snack_10'] = 1; new_order($order); // Redirect browser header("Location: http://" . $_SERVER['SERVER_NAME'] . "/dashboard"); // Make sure that code below does not get executed when we redirect exit; }
$return_array['code_erreur'] = AJAX_OK; $return_array['reponse'] = 'La commande de ' . $commande['client_prenom'] . ' ' . $commande['client_nom'] . ' a été annulée avec succès'; } } function refresh_histo() { global $return_array; $return_array['code_erreur'] = AJAX_OK; $return_array['reponse'] = 'Historique des commandes rafrachit avec succès'; } $alias = array(); /*/////////////////////////////CORPS/////////////////////////////*/ if (isset($_GET['action'])) { switch ($_GET['action']) { case "order": new_order(); break; case "add_cash": add_cash(); break; case "cancel": cancel(); break; case "extern_order": extern_order(); break; case "refresh_histo": refresh_histo(); break; default: $return_array['code_erreur'] = INVALID_ACTION;