first alpha
This commit is contained in:
@ -1,5 +1,13 @@
|
||||
<?php
|
||||
include "log.php";
|
||||
if ( !isset($site) )
|
||||
{
|
||||
require_once( "config.inc.php" );
|
||||
header( 'Location: ' . $accueil );
|
||||
}
|
||||
|
||||
require_once "config.inc.php";
|
||||
require_once "log.php";
|
||||
|
||||
$table_prefix = "";
|
||||
class db
|
||||
{
|
||||
@ -26,7 +34,7 @@ class db
|
||||
public $destLat;
|
||||
public $destLon;
|
||||
public $destName;
|
||||
public $status;
|
||||
public $public;
|
||||
public $color;
|
||||
public $actual_lat;
|
||||
public $actual_lon;
|
||||
@ -78,40 +86,62 @@ class db
|
||||
//print_r( $this );
|
||||
}
|
||||
|
||||
function print_error()
|
||||
{
|
||||
print_r( $this );
|
||||
//$this->error = $this->error;
|
||||
return $this->connect->error;
|
||||
}
|
||||
|
||||
function newPlane()
|
||||
{
|
||||
$query = "INSERT INTO avionpoeme SET (";
|
||||
$query .= $this->message . ", ";
|
||||
$query .= $this->expeMail . ", ";
|
||||
$query .= $this->expeKnown . ", ";
|
||||
$query .= $this->expeLang . ", ";
|
||||
$query .= $this->destLang . ", ";
|
||||
$query .= $this->startLat . ", ";
|
||||
$query .= $this->startLon . ", ";
|
||||
$query .= $this->startName . ", ";
|
||||
$query .= $this->startTime . ", ";
|
||||
$query .= $this->StartTZ . ", ";
|
||||
$query .= $this->destMail . ", ";
|
||||
$query .= $this->destLat . ", ";
|
||||
$query .= $this->destLon . ", ";
|
||||
$query .= $this->destName . ", ";
|
||||
$query .= $this->status . ", ";
|
||||
$query .= $this->color . ", ";
|
||||
$query .= $this->actual_lat . ", ";
|
||||
$query .= $this->actual_lon . ", ";
|
||||
$query .= $this->bearing . ", ";
|
||||
$query .= $this->deliveryTime . ", ";
|
||||
$query .= $this->deliveryTZ . ", ";
|
||||
$query .= $this->deliveryTimeServer . ", ";
|
||||
$query = "INSERT INTO avionpoeme VALUES ('0','";
|
||||
$query .= $this->protect($this->message) . "', '";
|
||||
$query .= $this->protect($this->expeMail) . "', ";
|
||||
$query .= $this->protect($this->expeKnown) . ", '";
|
||||
$query .= $this->protect($this->expeLang) . "', '";
|
||||
$query .= $this->protect($this->destLang) . "', '";
|
||||
$query .= $this->protect($this->startLat) . "', '";
|
||||
$query .= $this->protect($this->startLon) . "', '";
|
||||
$query .= $this->protect($this->startName) . "', '";
|
||||
$query .= $this->protect($this->startTime) . "', '";
|
||||
$query .= $this->protect($this->StartTZ) . "', '";
|
||||
$query .= $this->protect($this->destMail) . "', '";
|
||||
$query .= $this->protect($this->destLat) . "', '";
|
||||
$query .= $this->protect($this->destLon) . "', '";
|
||||
$query .= $this->protect($this->destName) . "', ";
|
||||
$query .= $this->protect($this->public) . ", '";
|
||||
$query .= $this->protect($this->color) . "', '";
|
||||
$query .= $this->protect($this->actual_lat) . "', '";
|
||||
$query .= $this->protect($this->actual_lon) . "', '";
|
||||
$query .= $this->protect($this->bearing) . "', '";
|
||||
$query .= $this->protect($this->deliveryTime) . "', '";
|
||||
$query .= $this->protect($this->deliveryTZ) . "', '";
|
||||
$query .= $this->protect($this->deliveryTimeServer) . "'";
|
||||
$query .= ")";
|
||||
print_r($this);
|
||||
$this->query($query);
|
||||
echo "{'uid':'" . $this->connect->insert_id . "'}";
|
||||
}
|
||||
|
||||
function getCurrentPlanes()
|
||||
{
|
||||
$query = "SELECT deliveryTime, deliveryTZ, destLat, destLon, destName, sentTime, sentTZ, startLon, startLat, startName, color FROM avionpoeme WHERE deliveryTimeServer>NOW() AND public='1'";
|
||||
$db->query($query);
|
||||
$planes = $db->fetch_all(MYSQLI_ASSOC);
|
||||
print json_encode($planes);
|
||||
}
|
||||
|
||||
function getAnthology($page=0)
|
||||
{
|
||||
if ($page==0) //renvoie le nombre de ligne d'anthologie
|
||||
{
|
||||
$query = "SELECT COUNT(*) as count FROM avionpoeme WHERE public='1'";
|
||||
$db->query($query);
|
||||
print "['" . $db->data_seek(0) . "']";
|
||||
}else //renvoie les lignes d'anthologie
|
||||
{
|
||||
$query = "SELECT deliveryTime, deliveryTZ, destName, sentTime, sentTZ, startName, message FROM avionpoeme WHERE public='1' LIMIT " . ($page-1)*20+1 . ",20";
|
||||
$db->query($query);
|
||||
$planes = $db->fetch_all(MYSQLI_ASSOC);
|
||||
print json_encode($planes);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user