main #6
71
home.php
71
home.php
|
@ -10,52 +10,59 @@ $gchange = new Gchange();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$player = $gchange->getUser($_SESSION['player_pubkey']);
|
$player = $gchange->getUser($_SESSION['player_pubkey']);
|
||||||
|
|
||||||
} catch (Exception $errMsg) {
|
} catch (Exception $errMsg) {
|
||||||
|
|
||||||
ErrorsHandler::kaput($errMsg);
|
ErrorsHandler::kaput($errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<header>
|
<header>
|
||||||
Bienvenue '. $player->getUserName() . ' !
|
Bienvenue '. $player->getUserName() . ' !
|
||||||
<!-- ('. substr($player->getUserGchangeId(), 0, 8) . ') -->
|
<!-- ('. substr($player->getUserGchangeId(), 0, 8) . ') -->
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li id="dashboard-map">
|
<li id="dashboard-map">
|
||||||
<a href="map.php">
|
<a href="map.php">
|
||||||
<span>
|
<span>
|
||||||
Carte
|
Carte
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="dashboard-messenger">
|
<li id="dashboard-messenger">
|
||||||
<a href="messenger.php">
|
<a href="messenger.php">
|
||||||
<span>
|
<span>
|
||||||
Messagerie
|
Messagerie
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="dashboard-farfetched">
|
<li id="dashboard-farfetched">
|
||||||
<a href="farfetched.php">
|
<a href="farfetched.php">
|
||||||
<span>
|
<span>
|
||||||
À distance ou en livraison
|
À distance ou en livraison
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="dashboard-minelife">
|
<li id="dashboard-minelife">
|
||||||
<a href="minelife.html">
|
<a href="minelife.html">
|
||||||
<span>
|
<span>
|
||||||
Manuel
|
Manuel
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li id="dashboard-TW">
|
||||||
|
<a href="/ipns/'. $_SESSION['player_ipns'].'">
|
||||||
|
<span>
|
||||||
|
TW
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,63 +2,63 @@
|
||||||
|
|
||||||
class ErrorsHandler {
|
class ErrorsHandler {
|
||||||
|
|
||||||
public function __construct () {
|
public function __construct () {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function kaput ($errorMsgs) {
|
static public function kaput ($errorMsgs) {
|
||||||
|
|
||||||
|
|
||||||
ob_get_clean(); // to prevent error message to display inside an HTML container (case of error generated by get method calls)
|
ob_get_clean(); // to prevent error message to display inside an HTML container (case of error generated by get method calls)
|
||||||
|
|
||||||
|
|
||||||
if (!is_array($errorMsgs)) {
|
if (!is_array($errorMsgs)) {
|
||||||
|
|
||||||
$errorMsgs = explode("\n", $errorMsgs);
|
$errorMsgs = explode("\n", $errorMsgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<!DOCTYPE html>
|
echo '<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>'. _('Erreur critique') . '</title>
|
<title>'. ('Erreur critique') . '</title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
div {
|
div {
|
||||||
|
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
background-color: hsl(0, 100%, 69%);
|
background-color: hsl(0, 100%, 69%);
|
||||||
color: hsl(0, 100%, 19%);
|
color: hsl(0, 100%, 19%);
|
||||||
margin: 1em;
|
margin: 1em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
border-radius: 1em;
|
border-radius: 1em;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: calc(100% - 4em);
|
width: calc(100% - 4em);
|
||||||
max-height: calc(100vh - 4em);
|
max-height: calc(100vh - 4em);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div>';
|
<div>';
|
||||||
|
|
||||||
|
|
||||||
foreach ($errorMsgs as $msg) {
|
foreach ($errorMsgs as $msg) {
|
||||||
|
|
||||||
echo '<pre>' . print_r($msg, true) . '</pre>';
|
echo '<pre>' . print_r($msg, true) . '</pre>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>';
|
</html>';
|
||||||
|
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,175 +1,159 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Fred {
|
class Fred {
|
||||||
|
|
||||||
private $gatewayProtocol = 'http';
|
|
||||||
|
|
||||||
private $gatewayDomain = 'libra.copylaradio.com';
|
private $gatewayProtocol = 'https';
|
||||||
|
|
||||||
private $gatewayPort = '1234';
|
private $gatewayDomain = 'astroport.copylaradio.com';
|
||||||
|
|
||||||
private $gatewayDelay = 3;
|
private $gatewayPort = ''; // :1234
|
||||||
|
|
||||||
public function __construct () {
|
private $gatewayDelay = 6;
|
||||||
|
|
||||||
}
|
public function __construct () {
|
||||||
|
|
||||||
public function donneMoiLaPutainDeClefIPNS ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) {
|
}
|
||||||
|
|
||||||
$salt = $prenomNom;
|
public function donneMoiLaPutainDeClefIPNS ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) {
|
||||||
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
|
|
||||||
|
|
||||||
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper);
|
$salt = $prenomNom;
|
||||||
|
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
|
||||||
|
|
||||||
$page1 = file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query);
|
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) .'&getipns=yes';
|
||||||
|
|
||||||
if (empty($page1)) {
|
|
||||||
|
|
||||||
throw new Exception("J'ai pas pû récupérer la putain de première page.");
|
$page1 = file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain . $this->gatewayPort . '/?' . $query);
|
||||||
}
|
|
||||||
|
|
||||||
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
if (empty($page1)) {
|
||||||
|
|
||||||
$url = $matches[1];
|
throw new Exception("J'ai pas pû récupérer la putain de première page.");
|
||||||
|
}
|
||||||
sleep($this->gatewayDelay);
|
|
||||||
|
|
||||||
$page2 = file_get_contents($url);
|
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
||||||
|
|
||||||
if (empty($page2)) {
|
$urlipns = $matches[1];
|
||||||
|
|
||||||
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
|
$page2 = '';
|
||||||
}
|
$rounds = 0;
|
||||||
|
|
||||||
preg_match("`url='.*/ipns/([^']+)'`isU", $page2, $matches);
|
while (empty($page2) and $rounds < 10) {
|
||||||
|
|
||||||
$ipnsKey = $matches[1];
|
sleep($this->gatewayDelay);
|
||||||
|
$page2 = file_get_contents($urlipns);
|
||||||
|
}
|
||||||
|
|
||||||
return $ipnsKey;
|
if (empty($page2)) {
|
||||||
}
|
|
||||||
|
|
||||||
public function donneMoiSesPutainDeMessagesGchange ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday, $gchangeName) {
|
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$ClearText = preg_replace( "/\n\s+/", "\n", rtrim(html_entity_decode(strip_tags($page2))) );
|
||||||
|
preg_match("`url='([^']+)'`isU", $ClearText, $matches);
|
||||||
|
|
||||||
$salt = $prenomNom;
|
$ipnsKey = $matches[1];
|
||||||
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
|
|
||||||
|
|
||||||
$query = 'salt='. $salt .'&pepper='. $pepper . '&messaging=' . $gchangeName;
|
return $ipnsKey;
|
||||||
|
}
|
||||||
|
|
||||||
$url = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query;
|
public function donneMoiSesPutainDeMessagesGchange ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday, $gchangeName) {
|
||||||
|
|
||||||
// echo '<pre>'; var_dump(htmlspecialchars($url)); echo '</pre>';
|
|
||||||
|
|
||||||
$page1 = file_get_contents($url);
|
$salt = $prenomNom;
|
||||||
|
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
|
||||||
|
|
||||||
if (empty($page1)) {
|
$query = 'salt='. $salt .'&pepper='. $pepper . '&messaging=' . $gchangeName;
|
||||||
|
|
||||||
throw new Exception("J'ai pas pû récupérer la putain de première page.");
|
$page1 = file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query);
|
||||||
}
|
|
||||||
|
|
||||||
// echo '<pre>'; var_dump(htmlspecialchars($page1)); echo '</pre>';
|
if (empty($page1)) {
|
||||||
|
|
||||||
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
throw new Exception("J'ai pas pû récupérer la putain de première page.");
|
||||||
|
}
|
||||||
|
|
||||||
$url = $matches[1];
|
// echo '<pre>'; var_dump(htmlspecialchars($page1)); echo '</pre>';
|
||||||
|
|
||||||
// echo '<pre>'; var_dump($url); echo '</pre>';
|
|
||||||
|
|
||||||
$page2 = '';
|
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
||||||
$rounds = 0;
|
|
||||||
|
|
||||||
while (empty($page2) and $rounds < 10) {
|
$urlmessages = $matches[1];
|
||||||
|
|
||||||
sleep($this->gatewayDelay);
|
// echo '<pre>'; var_dump($urli); echo '</pre>';
|
||||||
$page2 = file_get_contents($url);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($page2)) {
|
$page2 = '';
|
||||||
|
$rounds = 0;
|
||||||
|
|
||||||
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
|
while (empty($page2) and $rounds < 10) {
|
||||||
}
|
|
||||||
|
|
||||||
// echo '<pre>'; var_dump(htmlspecialchars($page2)); echo '</pre>';
|
|
||||||
|
|
||||||
$json = $page2;
|
sleep($this->gatewayDelay);
|
||||||
|
$page2 = file_get_contents($urlmessages);
|
||||||
return json_decode($json);
|
}
|
||||||
|
|
||||||
}
|
if (empty($page2)) {
|
||||||
|
|
||||||
public function donneMoiSaPutaindeG1Pub ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) {
|
|
||||||
|
|
||||||
|
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
|
||||||
|
}
|
||||||
|
|
||||||
$salt = $prenomNom;
|
// echo '<pre>'; var_dump(htmlspecialchars($page2)); echo '</pre>';
|
||||||
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
|
|
||||||
|
|
||||||
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) . '&g1pub=on';
|
$json = $page2;
|
||||||
|
|
||||||
$url = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query;
|
return json_decode($json);
|
||||||
|
|
||||||
// echo '<pre>'; var_dump(htmlspecialchars($url)); echo '</pre>';
|
}
|
||||||
|
|
||||||
$opts = array(
|
public function donneMoiSaPutaindeG1Pub ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) {
|
||||||
'http'=>array(
|
|
||||||
'method'=>"GET",
|
|
||||||
'header'=>"Accept-language: fr\r\n",
|
|
||||||
'follow_location' => 0
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$context = stream_context_create($opts);
|
|
||||||
|
|
||||||
$page1 = file_get_contents($url, false, $context);
|
$salt = $prenomNom;
|
||||||
|
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
|
||||||
|
|
||||||
|
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) . '&getg1pub=yes';
|
||||||
|
|
||||||
if (empty($page1)) {
|
$urlj = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query;
|
||||||
|
|
||||||
throw new Exception("J'ai pas pû récupérer la putain de première page.");
|
// echo '<pre>'; var_dump(htmlspecialchars($urlj)); echo '</pre>';
|
||||||
}
|
|
||||||
|
|
||||||
// die('<pre>' . htmlspecialchars($page1) . '</pre>');
|
$opts = array(
|
||||||
|
'http'=>array(
|
||||||
|
'method'=>"GET",
|
||||||
|
'header'=>"Accept-language: fr\r\n",
|
||||||
|
'follow_location' => 0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
$context = stream_context_create($opts);
|
||||||
|
|
||||||
// die(
|
$page1 = file_get_contents($urlj, false, $context);
|
||||||
// '<pre>' . htmlspecialchars($page1) . '</pre>' .
|
|
||||||
// '<pre>' . print_r($matches, true) . '</pre>'
|
|
||||||
// );
|
|
||||||
|
|
||||||
$url = $matches[1];
|
|
||||||
|
|
||||||
// die('<pre>' . var_dump($url, true) . '</pre>');
|
if (empty($page1)) {
|
||||||
|
|
||||||
$opts2 = array(
|
throw new Exception("J'ai pas pû récupérer la putain de première page.");
|
||||||
'http'=>array(
|
}
|
||||||
'method'=>"GET",
|
|
||||||
'header'=>"Accept-language: fr\r\n",
|
|
||||||
'follow_location' => 0
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$context2 = stream_context_create($opts2);
|
// die('<pre>' . htmlspecialchars($page1) . '</pre>');
|
||||||
|
|
||||||
$page2 = '';
|
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
||||||
|
|
||||||
$rounds = 0;
|
// die(
|
||||||
|
// '<pre>' . htmlspecialchars($page1) . '</pre>' .
|
||||||
|
// '<pre>' . print_r($matches, true) . '</pre>'
|
||||||
|
// );
|
||||||
|
|
||||||
while (empty($page2) and $rounds < 10) {
|
$urlg1pub = $matches[1];
|
||||||
|
|
||||||
sleep($this->gatewayDelay);
|
$page2 = '';
|
||||||
|
sleep($this->gatewayDelay);
|
||||||
|
$page2 = file_get_contents($urlg1pub);
|
||||||
|
|
||||||
$page2 = file_get_contents($url, false, $context2);
|
if (empty($page2)) {
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($page2)) {
|
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
|
||||||
|
}
|
||||||
|
|
||||||
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
|
$ClearText = preg_replace( "/\n\s+/", "\n", rtrim(html_entity_decode(strip_tags($page2))) );
|
||||||
}
|
preg_match("`url='([^']+)'`isU", $ClearText, $matches);
|
||||||
|
|
||||||
preg_match("`url='.*/user/([^']+)/'`isU", $page2, $matches);
|
$gchangeId = $matches[1];
|
||||||
|
|
||||||
$gchangeId = $matches[1];
|
return $gchangeId;
|
||||||
|
}
|
||||||
return $gchangeId;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
106
login.php
106
login.php
|
@ -12,76 +12,80 @@ $playerG1Id = null;
|
||||||
|
|
||||||
if (isset($_POST['salt'], $_POST['pepper'])) {
|
if (isset($_POST['salt'], $_POST['pepper'])) {
|
||||||
|
|
||||||
$fred = new Fred();
|
$fred = new Fred();
|
||||||
$keygen = new Keygen();
|
$keygen = new Keygen();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$playerG1Id = $fred->donneMoiSaPutaindeG1Pub($_POST['salt'], $_POST['pepper']);
|
$playerG1Id = $fred->donneMoiSaPutaindeG1Pub($_POST['salt'], $_POST['pepper']);
|
||||||
$keygen->generatePubsec($_POST['salt'], $_POST['pepper']);
|
sleep(3);
|
||||||
|
$playerIPNS = $fred->donneMoiLaPutainDeClefIPNS($_POST['salt'], $_POST['pepper']);
|
||||||
|
|
||||||
} catch (Exception $errMsg) {
|
// $keygen->generatePubsec($_POST['salt'], $_POST['pepper']);
|
||||||
|
|
||||||
ErrorsHandler::kaput($errMsg);
|
} catch (Exception $errMsg) {
|
||||||
}
|
|
||||||
|
|
||||||
$_SESSION['player_pubkey'] = $playerG1Id;
|
ErrorsHandler::kaput($errMsg);
|
||||||
|
}
|
||||||
$gchange = new Gchange();
|
|
||||||
|
|
||||||
try {
|
$_SESSION['player_pubkey'] = $playerG1Id;
|
||||||
|
$_SESSION['player_ipns'] = $playerIPNS;
|
||||||
|
|
||||||
$player = $gchange->getUser($_SESSION['player_pubkey']);
|
$gchange = new Gchange();
|
||||||
|
|
||||||
} catch (Exception $errMsg) {
|
try {
|
||||||
|
|
||||||
ErrorsHandler::kaput($errMsg);
|
$player = $gchange->getUser($_SESSION['player_pubkey']);
|
||||||
}
|
|
||||||
|
|
||||||
$_SESSION['player_lat'] = $player->_source->geoPoint->lat;
|
} catch (Exception $errMsg) {
|
||||||
$_SESSION['player_lon'] = $player->_source->geoPoint->lon;
|
|
||||||
$_SESSION['radius'] = DEFAULT_RADIUS;
|
|
||||||
|
|
||||||
$_SESSION['salt'] = $_POST['salt'];
|
ErrorsHandler::kaput($errMsg);
|
||||||
$_SESSION['pepper'] = $_POST['pepper'];
|
}
|
||||||
|
|
||||||
header('Location:home.php');
|
$_SESSION['player_lat'] = $player->_source->geoPoint->lat;
|
||||||
|
$_SESSION['player_lon'] = $player->_source->geoPoint->lon;
|
||||||
|
$_SESSION['radius'] = DEFAULT_RADIUS;
|
||||||
|
|
||||||
|
$_SESSION['salt'] = $_POST['salt'];
|
||||||
|
$_SESSION['pepper'] = $_POST['pepper'];
|
||||||
|
|
||||||
|
header('Location:home.php');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$bodyIds = 'login-page';
|
$bodyIds = 'login-page';
|
||||||
$webpageTitle = $games[$_SESSION['gameId']]['title'];
|
$webpageTitle = $games[$_SESSION['gameId']]['title'];
|
||||||
|
|
||||||
include_once('header.php');
|
|
||||||
|
|
||||||
echo '
|
include_once('header.php');
|
||||||
<form method="post" action="">
|
|
||||||
|
|
||||||
<fieldset>
|
echo '
|
||||||
<legend>Identification par Ğchange</legend>
|
<form method="post" action="">
|
||||||
|
|
||||||
<p>
|
<fieldset>
|
||||||
<label>
|
<legend>Identification par Ğchange</legend>
|
||||||
Identifiant :
|
|
||||||
<input type="text" name="salt" />
|
|
||||||
</label>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label>
|
<label>
|
||||||
Mot de passe :
|
Identifiant :
|
||||||
<input type="password" name="pepper" />
|
<input type="text" name="salt" />
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
<p>
|
<label>
|
||||||
<input type="submit" value="Jouer" />
|
Mot de passe :
|
||||||
</p>
|
<input type="password" name="pepper" />
|
||||||
</fieldset>
|
</label>
|
||||||
</form>
|
</p>
|
||||||
';
|
|
||||||
|
|
||||||
include_once('footer.php');
|
<p>
|
||||||
|
<input type="submit" value="Jouer" />
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
';
|
||||||
|
|
||||||
|
include_once('footer.php');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue