time(), "start"=>(int) $_POST['start'], "end"=>(int) $_POST['end'], "min"=>$min, "sec"=>$sec, "pseudo"=>$pseudo); // TODO : Upload + taille max de l'upload if(count($data) == 1 || $min != $data[count($data)-2]['min'] || $sec != $data[count($data)-2]['sec'] || $_POST['start'] != $data[count($data)-2]['start'] || $_POST['end'] != $data[count($data)-2]['end'] || $pseudo != $data[count($data)-2]['pseudo']) { file_put_contents('data/data', base64_encode(gzdeflate(serialize($data)))); } } ?> DéfiVélib

DéfiVélib

Définition du code de synchronisation.
Vous pouvez désormais mettre à jour la liste des stations en visitant l'adresse suivante (update URL) :
http://" . $_SERVER["SERVER_NAME"].$_SERVER['REQUEST_URI']."?update=1&code=".$code_synchro."

Il est possible d'automatiser la tâche via une tâche cron. Par exemple (see README) :
* * * * * wget -q -O http://" . $_SERVER["SERVER_NAME"].$_SERVER['REQUEST_URI']."?update=1&code=".$code_synchro." #Commande de mise a jour des stations de velib

"; } if(!empty($_GET['update']) || !empty($code_synchro)) //If we want to make an update (or first run) { if(empty($code_synchro) && is_file('data/config')) //If not first run, get the synchronisation code from data file { $data = unserialize(gzinflate(base64_decode(file_get_contents('data/config')))); $code_synchro = $data[0]; } if(!empty($_GET['code']) && $_GET['code'] == $code_synchro) //Once we have the code and it is correct { $stations_xml = simplexml_load_file('http://www.velib.paris.fr/service/carto'); $liste_stations = array(); foreach($stations_xml->markers->marker as $station) { $liste_stations[(int) $station['number']] = array('name'=>(string) $station['name'], 'address'=>(string) $station['fullAddress'], 'lat'=>(float) $station['lat'], 'lng'=>(float) $station['lng']); } file_put_contents('data/stations', base64_encode(gzdeflate(serialize($liste_stations)))); echo "

Mise à jour de la liste des stations effectuée avec succès (Update successful).

"; } else { echo "

Mauvais code de vérification (Error : bad synchronisation code). Veuillez réessayer la mise à jour. Se référer au README pour plus d'informations sur la mise à jour.

"; } echo "

Retourner à l'application (Back to index)

"; exit(); } $liste_stations = unserialize(gzinflate(base64_decode(file_get_contents('data/stations')))); ?>

Ajouter un trajet

Trajet

min s

Informations

RésultatsDerniers trajets ajoutés

$result) { $min[$key] = $result['min']; $sec[$key] = $result['sec']; } array_multisort($min, SORT_DESC, $sec, SORT_DESC, $data); foreach($data as $key=>$result) { if(!empty($_SESSION['admin'])) { $delete = ""; } else { $delete = ""; } echo "".$delete.""; } } else { for($i = count($data) - 1; $i >= max(count($data) - 10, 0); $i--) { if(!empty($_SESSION['admin'])) { $delete = ""; } else { $delete = ""; } echo "".$delete.""; } } ?>
Date Départ Arrivée Temps Pseudo Supprimer
Supprimer
".date('d/m/Y à H:i', $result['date'])."".htmlspecialchars($liste_stations[$result['start']]['name'])."".htmlspecialchars($liste_stations[$result['end']]['name'])."".(int) $result['min']."min ".(int) $result['sec']."s".htmlspecialchars($result['pseudo'])."
Supprimer
".date('d/m/Y à H:i', $data[$i]['date'])."".htmlspecialchars($liste_stations[$data[$i]['start']]['name'])."".htmlspecialchars($liste_stations[$data[$i]['end']]['name'])."".(int) $data[$i]['min']."min ".(int) $data[$i]['sec']."s".htmlspecialchars($data[$i]['pseudo'])."

Aucun trajet enregistré.

Recherche de trajets

Déconnexion