function share_post() { $data = json_decode($_POST['data'], true); // Get driver info $driver_id = $_SESSION['user_id']; if (!$driver_id) { return functions\json_respond('ERROR', "User not logged in!"); } // Store places $origin_id = database\add_place($data['route']['origin']); $destination_id = database\add_place($data['route']['destination']); if (!($origin_id or $destination_id)) { return functions\json_respond('ERROR', "Couldn't store places!"); } // Store trip $trip_data = array('driver_id' => $driver_id, 'spots' => $data['spots'], 'length' => $data['route']['trip_length'], 'message' => $data['message'], 'women_only' => $data['women_only'], 'departure_time' => $data['departure'], 'origin_id' => $origin_id, 'destination_id' => $destination_id); $trip_id = database\add_trip($trip_data); if (!$trip_id) { return json_respond('ERROR', "Couldn't store trip!"); } functions\json_respond('OK', 'Trip saved!'); }
$headers = getHeaders(); $headers = serialize($headers); $headers = $db->escape($headers); $post = serialize($post); $post = $db->escape($post); $saved = $db->query("INSERT INTO alarms (id, post, headers, owner) VALUES (NULL,\"{$post}\", \"{$headers}\", \"{$owner}\")"); if ($saved) { $status = "OK"; $msg = $db->insert_id . ": Alarm Saved."; json_respond($status, $msg); } else { $status = "Error"; $msg = "Database Error, failed to save post."; json_respond($status, $msg); } } else { // ^Above^ checks failed, user ends up here. $status = "Fatal"; $msg = "Fatal Error Occurred, it all went wrong!"; json_respond($status, $msg); } } else { /** Rackspace Header was not found, end. **/ $status = "NoData"; $msg = "Error: No Data Received."; json_respond($status, $msg); }
if ($color) { $db->insert('abalone_balls', ['player_id' => $arrPlayerByColor[$color]] + $conditions); } } $db->update('abalone_games', array('turn' => $objOpponent->color), array('id' => $objGame->id)); }, $context); if ($success) { return json_respond(array('error' => 0)); } return json_respond(array('error' => 'Db exception?')); } return json_respond(array('error' => 'Not your turn!')); } else { if (isset($_GET['status'])) { $status = (object) array('turn' => $objGame->turn, 'opponent' => (int) $objOpponent->id); return json_respond(array('error' => 0, 'status' => $status)); } } // Always be on the 'login' page, to save the URL if (empty($_GET['login'])) { header('Location: ?login='******'http://' . $_SERVER['HTTP_HOST'] . '/143.php?login=' . $objOpponent->password; ?> <html> <head> <title>Abalone</title> <link rel="stylesheet" href="143.css" /> </head>