diff --git a/lib/Fred.class.php b/lib/Fred.class.php
index f802e6a..14ff855 100644
--- a/lib/Fred.class.php
+++ b/lib/Fred.class.php
@@ -100,8 +100,9 @@ class Fred {
);
$context = stream_context_create($opts);
- $page1 = file_get_contents($url, false, $context)
- or die('On a fait du sale.
');
+
+
+ $page1 = file_get_contents($url, false, $context);
// die('' . htmlspecialchars($page1) . '
');
@@ -134,7 +135,7 @@ class Fred {
sleep($this->gatewayDelay);
- $page2 = file_get_contents($url, false, $context2) or die(''. var_dump($page2, true) . '
');
+ $page2 = file_get_contents($url, false, $context2);
}
preg_match("`url='.*/user/([^']+)/'`isU", $page2, $matches);
diff --git a/lib/Gchange.class.php b/lib/Gchange.class.php
index 9ec0b50..6d425f9 100644
--- a/lib/Gchange.class.php
+++ b/lib/Gchange.class.php
@@ -267,7 +267,7 @@ class Gchange {
$queryParams = [
'size' => $n,
- 'fields' => ['_id'],
+ // 'fields' => ['_id'],
'query' => [
'bool' => [
'filter' => [
@@ -417,7 +417,7 @@ class Gchange {
$queryParams = [
'size' => $n
- ,'fields' => ['_id']
+ // ,'fields' => ['_id']
,'query' => [
'nested' => [
'path' => 'socials',
diff --git a/login.php b/login.php
index 481e4d9..55f5498 100644
--- a/login.php
+++ b/login.php
@@ -3,25 +3,42 @@ require_once('config.php');
require_once('lib/Gchange.class.php');
require_once('lib/Fred.class.php');
require_once('lib/Keygen.class.php');
+require_once('lib/ErrorsHandler.class.php');
+$toto = 'QP1VkfaFUMdHZmHgPMi7q5wJJHaQhZcEqs5A86NigKr';
+$boris = '25zB1gSC7Qhwnx463cuDLDCKLRVieLAgFiPbYq6jVHG9';
+$playerG1Id = null;
+
if (isset($_POST['salt'], $_POST['pepper'])) {
$fred = new Fred();
$keygen = new Keygen();
- $playerG1Id = $fred->donneMoiSaPutaindeG1Pub($_POST['salt'], $_POST['pepper']);
- $toto = 'QP1VkfaFUMdHZmHgPMi7q5wJJHaQhZcEqs5A86NigKr';
- $boris = '25zB1gSC7Qhwnx463cuDLDCKLRVieLAgFiPbYq6jVHG9';
- // $playerG1Id = $toto;
+ try {
+
+ $playerG1Id = $fred->donneMoiSaPutaindeG1Pub($_POST['salt'], $_POST['pepper']);
+
+ } catch (Exception $errMsg) {
+
+ ErrorsHandler::kaput($errMsg);
+ }
$_SESSION['player_pubkey'] = $playerG1Id;
$gchange = new Gchange();
- $user = $gchange->getUser($_SESSION['player_pubkey']);
- $_SESSION['player_lat'] = $user->_source->geoPoint->lat;
- $_SESSION['player_lon'] = $user->_source->geoPoint->lon;
+ try {
+
+ $player = $gchange->getUser($_SESSION['player_pubkey']);
+
+ } catch (Exception $errMsg) {
+
+ ErrorsHandler::kaput($errMsg);
+ }
+
+ $_SESSION['player_lat'] = $player->_source->geoPoint->lat;
+ $_SESSION['player_lon'] = $player->_source->geoPoint->lon;
$_SESSION['radius'] = DEFAULT_RADIUS;
$_SESSION['salt'] = $_POST['salt'];
diff --git a/map.php b/map.php
index bb8f34b..9578cc3 100644
--- a/map.php
+++ b/map.php
@@ -102,7 +102,7 @@ echo '
*/
$places = $gchange->getPlacesNearUser($player, $_SESSION['radius']);
-
+
$selectedPlace = NULL;
foreach ($places as $place) {