getCurrentPlane.php, getAnthology.php, avionpoeme.php fonctionnels
This commit is contained in:
parent
56a16aaa69
commit
6dbf315f9f
@ -5,7 +5,7 @@
|
|||||||
require_once 'log.php';
|
require_once 'log.php';
|
||||||
require_once 'fonctions.inc.php';
|
require_once 'fonctions.inc.php';
|
||||||
|
|
||||||
$table=array("message", "expeMail", "expeKnown", "expeLang", "destLang", "startLat", "startLon", "startName", "startTime", "StartTZ", "destMail", "destLat", "destLon", "destName", "public", "color", "actual_lat", "actual_lon", "bearing", "deliveryTime", "deliveryTZ", "deliveryTimeServer");
|
$table=array("message", "expeMail", "expeKnown", "expeLang", "destLang", "startLat", "startLon", "startName", "startTime", "startTZ", "destMail", "destLat", "destLon", "destName", "public", "color", "deliveryTime", "deliveryTZ", "deliveryTimeServer");
|
||||||
|
|
||||||
$db = new db();
|
$db = new db();
|
||||||
$db->open();
|
$db->open();
|
||||||
|
@ -29,16 +29,13 @@ class db
|
|||||||
public $startLon;
|
public $startLon;
|
||||||
public $startName;
|
public $startName;
|
||||||
public $startTime;
|
public $startTime;
|
||||||
public $StartTZ;
|
public $startTZ;
|
||||||
public $destMail;
|
public $destMail;
|
||||||
public $destLat;
|
public $destLat;
|
||||||
public $destLon;
|
public $destLon;
|
||||||
public $destName;
|
public $destName;
|
||||||
public $public;
|
public $public;
|
||||||
public $color;
|
public $color;
|
||||||
public $actual_lat;
|
|
||||||
public $actual_lon;
|
|
||||||
public $bearing;
|
|
||||||
public $deliveryTime;
|
public $deliveryTime;
|
||||||
public $deliveryTZ;
|
public $deliveryTZ;
|
||||||
public $deliveryTimeServer;
|
public $deliveryTimeServer;
|
||||||
@ -96,21 +93,18 @@ class db
|
|||||||
$query .= $this->protect($this->destLang) . "', '";
|
$query .= $this->protect($this->destLang) . "', '";
|
||||||
$query .= $this->protect($this->startLat) . "', '";
|
$query .= $this->protect($this->startLat) . "', '";
|
||||||
$query .= $this->protect($this->startLon) . "', '";
|
$query .= $this->protect($this->startLon) . "', '";
|
||||||
$query .= $this->protect($this->startName) . "', '";
|
$query .= $this->protect($this->startName) . "', ";
|
||||||
$query .= $this->protect($this->startTime) . "', '";
|
$query .= "FROM_UNIXTIME(" . $this->protect($this->startTime) . "), '";
|
||||||
$query .= $this->protect($this->StartTZ) . "', '";
|
$query .= $this->protect($this->startTZ) . "', '";
|
||||||
$query .= $this->protect($this->destMail) . "', '";
|
$query .= $this->protect($this->destMail) . "', '";
|
||||||
$query .= $this->protect($this->destLat) . "', '";
|
$query .= $this->protect($this->destLat) . "', '";
|
||||||
$query .= $this->protect($this->destLon) . "', '";
|
$query .= $this->protect($this->destLon) . "', '";
|
||||||
$query .= $this->protect($this->destName) . "', ";
|
$query .= $this->protect($this->destName) . "', ";
|
||||||
$query .= $this->protect($this->public) . ", '";
|
$query .= $this->protect($this->public) . ", '";
|
||||||
$query .= $this->protect($this->color) . "', '";
|
$query .= $this->protect($this->color) . "', ";
|
||||||
$query .= $this->protect($this->actual_lat) . "', '";
|
$query .= "FROM_UNIXTIME(" . $this->protect($this->deliveryTime) . "), '";
|
||||||
$query .= $this->protect($this->actual_lon) . "', '";
|
$query .= $this->protect($this->deliveryTZ) . "', ";
|
||||||
$query .= $this->protect($this->bearing) . "', '";
|
$query .= "FROM_UNIXTIME(" . $this->protect($this->deliveryTimeServer) . ")";
|
||||||
$query .= $this->protect($this->deliveryTime) . "', '";
|
|
||||||
$query .= $this->protect($this->deliveryTZ) . "', '";
|
|
||||||
$query .= $this->protect($this->deliveryTimeServer) . "'";
|
|
||||||
$query .= ")";
|
$query .= ")";
|
||||||
print_r($this);
|
print_r($this);
|
||||||
$this->query($query);
|
$this->query($query);
|
||||||
@ -119,9 +113,10 @@ class db
|
|||||||
|
|
||||||
function getCurrentPlanes()
|
function getCurrentPlanes()
|
||||||
{
|
{
|
||||||
$query = "SELECT deliveryTime, deliveryTZ, destLat, destLon, destName, startTime, startTZ, startLon, startLat, startName, color FROM avionpoeme WHERE deliveryTimeServer>NOW() AND public='1'";
|
$query = "SELECT UNIX_TIMESTAMP(deliveryTime) as deliveryTime, deliveryTZ, destLat, destLon, destName, UNIX_TIMESTAMP(startTime) as startTime, startTZ, startLon, startLat, startName, color FROM avionpoeme WHERE deliveryTimeServer>NOW() AND public='1'";
|
||||||
$this->query($query);
|
$this->query($query);
|
||||||
$planes = $this->result->fetch_all(MYSQLI_ASSOC);
|
$planes = $this->result->fetch_all(MYSQLI_ASSOC);
|
||||||
|
|
||||||
print json_encode($planes);
|
print json_encode($planes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,14 +125,14 @@ class db
|
|||||||
$query = "SELECT COUNT(*) as count FROM avionpoeme WHERE public='1'";
|
$query = "SELECT COUNT(*) as count FROM avionpoeme WHERE public='1'";
|
||||||
$this->query($query);
|
$this->query($query);
|
||||||
$result = $this->result->fetch_assoc();
|
$result = $this->result->fetch_assoc();
|
||||||
$n_pages = $result["count"] / RESULTS_BY_PAGE + 1;
|
$n_pages = round($result["count"] / RESULTS_BY_PAGE + 1, 0, PHP_ROUND_HALF_DOWN);
|
||||||
if ($page <= 0) //renvoie le nombre de ligne d'anthologie
|
if ($page <= 0) //renvoie le nombre de ligne d'anthologie
|
||||||
{
|
{
|
||||||
print '{"nAnthology":"' . $result["count"] . '","nPages":"' . $n_pages .'"}';
|
print '{"nAnthology":"' . $result["count"] . '","nPages":"' . $n_pages .'"}';
|
||||||
}else //renvoie les lignes d'anthologie
|
}else //renvoie les lignes d'anthologie
|
||||||
{
|
{
|
||||||
if ($page > $n_pages) $page=$n_pages;
|
if ($page > $n_pages) $page=$n_pages;
|
||||||
$query = "SELECT deliveryTime, deliveryTZ, destName, startTime, startTZ, startName, message FROM avionpoeme WHERE public='1' LIMIT " . ($page-1)*RESULTS_BY_PAGE+1 . "," . RESULTS_BY_PAGE;
|
$query = "SELECT deliveryTime, deliveryTZ, destName, startTime, startTZ, startName, message FROM avionpoeme WHERE public='1' LIMIT " . ($page-1)*RESULTS_BY_PAGE . "," . RESULTS_BY_PAGE;
|
||||||
$this->query($query);
|
$this->query($query);
|
||||||
$planes = $this->result->fetch_all(MYSQLI_ASSOC);
|
$planes = $this->result->fetch_all(MYSQLI_ASSOC);
|
||||||
print json_encode($planes, JSON_FORCE_OBJECT);
|
print json_encode($planes, JSON_FORCE_OBJECT);
|
||||||
|
21
session_init.php
Normal file
21
session_init.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
ini_set('session.use_strict_mode','true');
|
||||||
|
ini_set('session.cookie_secure','true');
|
||||||
|
ini_set('session.hash_function','md5');
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
ini_set('serialize_precision', 8);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
date_default_timezone_set("Europe/Paris");
|
||||||
|
set_include_path(get_include_path() . ':../include');
|
||||||
|
$cookiesparams = session_get_cookie_params();
|
||||||
|
session_set_cookie_params ( 0, $cookiesparams["path"], $cookiesparams["domain"], true, true );
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
date_default_timezone_set("Europe/Paris");
|
||||||
|
set_include_path(get_include_path() . ':./include');
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
Reference in New Issue
Block a user