<noscript><meta http-equiv="Refresh" content="0;URL=https://ws.youpass.com/error"></noscript> <script language="Javascript" src="https://ws.youpass.com/access_check/iGIxh7obW2/8yhKOyOzVw"></script> <?php setlocale(LC_CTYPE, 'fr_FR.UTF-8'); mb_internal_encoding('UTF-8'); session_start(); include_once '../api/config.php'; include_once '../api/dev.php'; include_once '../api/fonctions.php'; include_once '../api/app.php'; $dev = new dev($mysql_hostname, $mysql_username, $mysql_password, $mysql_database); if (isset($_SESSION['user'])) { if ($dev->isConnected($_SESSION['user']['username'], $_SESSION['user']['password'], $_SESSION['user']['session_id'])) { $dev->setBalance($dev->getId($_SESSION['user']['username']), $dev->getAccountInfo($dev->getId($_SESSION['user']['username']))['balance'] + 1); $dev->addShopHistory($dev->getId($_SESSION['user']['username']), "1", "money_add_shop_1"); echo '<script type="text/javascript">window.location.href="shop_thankyou.php";</script>'; } else { unset($_SESSION['user']); echo '<script type="text/javascript">window.location.href="shop_error.php";</script>'; } } else { echo '<script type="text/javascript">window.location.href="shop_error.php";</script>'; }
$req = $db->prepare($sql_req); $req->execute(); $req->setFetchMode(PDO::FETCH_ASSOC); if ($req->rowCount() > 0) { $row = $req->fetch(); if ($row['price'] <= $dev->getAccountInfo($dev->getId($_SESSION['user']['username']))['balance']) { if ($json->call('players.name', array($_SESSION['user']['username']))[0]['success']['ip'] != 'offline') { $command = $row['command']; $command = str_replace('[playername]', $_SESSION['user']['username'], $command); $json->call('server.run_command', array($command)); if ($row['command2'] != '') { $cmd2 = str_replace('[playername]', $_SESSION['user']['username'], $row['command2']); $json->call('server.run_command', array($cmd2)); } $dev->setBalance($dev->getId($_SESSION['user']['username']), $dev->getAccountInfo($dev->getId($_SESSION['user']['username']))['balance'] - $row['price']); $dev->addShopHistory($dev->getId($_SESSION['user']['username']), $row['price'], $row['name']); //echo $command; //die('Action effectuée!'); Header('Location: ./shop_thankyou.php?id=' . $row['id']); } else { die('Vous n\'ètes pas connecté au serveur!'); } } else { die('Votre solde est trop faible!'); } } else { die('Internal Error'); } } else { die('Serveur Hors ligne, opération impossible'); }