zeg1jeux/login.php

92 lines
2.1 KiB
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
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();
try {
$playerG1Id = $fred->donneMoiSaPutaindeG1Pub($_POST['salt'], $_POST['pepper']);
sleep(3);
$playerIPNS = $fred->donneMoiLaPutainDeClefIPNS($_POST['salt'], $_POST['pepper']);
// $keygen->generatePubsec($_POST['salt'], $_POST['pepper']);
} catch (Exception $errMsg) {
ErrorsHandler::kaput($errMsg);
}
$_SESSION['player_pubkey'] = $playerG1Id;
$_SESSION['player_ipns'] = $playerIPNS;
$gchange = new Gchange();
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'];
$_SESSION['pepper'] = $_POST['pepper'];
header('Location:home.php');
} else {
$bodyIds = 'login-page';
$webpageTitle = $games[$_SESSION['gameId']]['title'];
include_once('header.php');
echo '
<form method="post" action="">
<fieldset>
<legend>Identification par Ğchange</legend>
<p>
<label>
Identifiant :
<input type="text" name="salt" />
</label>
</p>
<p>
<label>
Mot de passe :
<input type="password" name="pepper" />
</label>
</p>
<p>
<input type="submit" value="Jouer" />
</p>
</fieldset>
</form>
';
include_once('footer.php');
}