$verbinding = @fsockopen($dev->getDvar('game_ip'), $dev->getDvar('game_port'), $errno, $errstr, 1); if (isset($_GET['id']) && is_numeric($_GET['id'])) { } else { die('Internal Error'); } if (isset($_SESSION['user'])) { if ($dev->isConnected($_SESSION['user']['username'], $_SESSION['user']['password'], $_SESSION['user']['session_id'])) { if ($verbinding) { $db = new PDO('mysql:host=' . $mysql_hostname . ';dbname=' . $mysql_database, $mysql_username, $mysql_password); $sql_req = "SELECT * FROM `web_shop` WHERE `id`=" . $_GET['id'] . ";"; $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!');
<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>'; }
<li><a href="../register.php" style="float:right;">S\'INSCRIRE</a></li>'; } ?> <div class="clearfix"></div> </ul> </div> <div id="fastlinks"> <a id="link" href="../rules.php">Règlement</a> </div> <div id="nav"> <div style="font-size: 22pt; color: rgb(44, 44, 44);">Bienvenue sur le Shop du serveur!</div> <?php if (isset($_SESSION['user'])) { ?> <div style="font-size: 14pt; color: rgb(44, 44, 44);">Solde actuelle : <?php echo $dev->getAccountInfo($dev->getId($_SESSION['user']['username']))['balance']; ?> €</div> <button id="button" style="padding:2px; font-size:1.1em;border:0;height:inherit;margin-top:5px;" onClick="money_popup();">Ajouter des fonds</button> <?php } $db = new PDO('mysql:host=' . $mysql_hostname . ';dbname=' . $mysql_database, $mysql_username, $mysql_password); $sql_req = "SELECT * FROM `web_shop` ORDER BY length(desc_) DESC;"; $req = $db->prepare($sql_req); $req->execute(); $req->setFetchMode(PDO::FETCH_ASSOC); if ($req->rowCount() > 0) { $array_ret = array(); while ($row = $req->fetch()) { array_push($array_ret, $row); }