Exemplo n.º 1
0
<?php

require '../base/Config.php';
Config::init();
$service = new LoginService();
$service->init();
if (isset($_POST["username"]) === false || isset($_POST["password"]) === false || isset($_POST["game"]) === false) {
    $service->error("login", 1);
}
$username = $_POST["username"];
$password = $_POST["password"];
$game = $_POST["game"];
if (!is_numeric($game)) {
    $service->error("login", 2);
}
error_log($username . "-" . $password . "-" . $game);
if ($service->login($username, $password, $game)) {
    $token_service = new TokenService();
    $token_service->init();
    $length = 16;
    $token = Common::createToken($length);
    $account = $username . "_enjoymi";
    $token_service->writeToken($account, $game, $token);
    $service->error("login", "0," . $account . "," . $token);
} else {
    $service->error("login", 4);
}
Exemplo n.º 2
0
<?php

require '../base/Config.php';
Config::init();
$service = new TokenService();
$service->init();
if (isset($_POST["account"]) === false || isset($_POST["token"]) === false || isset($_POST["game"]) === false) {
    $service->error("login", 1);
}
$account = $_POST["account"];
$game = $_POST["game"];
$token = $_POST["token"];
if (!is_numeric($game)) {
    $service->error("login", 2);
}
if ($service->checkToken($account, $game, $token)) {
    $service->error("login", 0);
} else {
    $service->error("login", -1);
}
Exemplo n.º 3
0
 /**
  * Get card details from Worldpay token
  * @param string $token
  * @return array card details
  * */
 public function getStoredCardDetails($token = false)
 {
     if (empty($token) || !is_string($token)) {
         Error::throwError('ip', Error::$errors['orderInput']['token']);
     }
     $response = TokenService::getStoredCardDetails($token);
     if (!isset($response['paymentMethod'])) {
         Error::throwError("apierror");
     }
     return $response['paymentMethod'];
 }