function showMonsterTown($bdd, $townID) { global $atown19, $atown20; $showMonsterTown = $bdd->prepare('SELECT * FROM Caranille_Towns_Monsters WHERE Town_Monster_Town_ID = ? ORDER BY Town_Monster_ID desc'); $showMonsterTown->execute([$townID]); ?> <br> <table class="table"> <tr> <th><?php echo $atown20; ?> </th> <th></th> </tr> <?php while ($monster = $showMonsterTown->fetch()) { $monsterID = stripslashes($monster['Town_Monster_Monster_ID']); $townMonsterID = stripslashes($monster['Town_Monster_ID']); ?> <tr> <td> <?php echo newMonster($bdd, $monsterID)->getName(); ?> </td> <td> <form method="POST" action="Delete.php"> <input type="hidden" name="townID" value="<?php echo $townID; ?> "> <input type="hidden" name="townMonsterID" value="<?php echo $townMonsterID; ?> "> <input class="btn btn-warning" type="submit" value="<?php echo $atown19; ?> "> </form> </td> </tr> <?php } ?> </table> <?php $showMonsterTown->closeCursor(); }
function showBattleMonsters($bdd, $townID, $monsterType) { global $dungeon1; $monsterListQuery = $bdd->prepare('SELECT * FROM Caranille_Towns_Monsters WHERE Town_Monster_Town_ID = ?'); $monsterListQuery->execute([$townID]); while ($monsterList = $monsterListQuery->fetch()) { $monsterID = stripslashes($monsterList['Town_Monster_Monster_ID']); $monster = newMonster($bdd, $monsterID); $monsterPicture = stripslashes($monster->getPicture()); ?> <br> <div class="panel panel-warning"> <div class="panel-heading"> <div class="row"> <div class="col-lg-2"> <img src="$monsterPicture" alt=""> </div> <div class="col-lg-10"> <?php echo "<h3 class=\"panel-title\">" . stripslashes($monster->getName()) . '</h3>' . stripslashes(nl2br($monster->getDescription())); ?> </div> </div> </div> <div class="panel-body"> <div class="row"> <div class="col-lg-2"> <?php echo "Niveau: " . stripslashes($monster->getLevel()) . "<br> HP: " . stripslashes($monster->getHP()) . "<br>MP: " . stripslashes($monster->getMP()); ?> </div> <div class="col-lg-10"> <form method="POST" action="Dungeon.php"> <input type="hidden" name="monsterID" value="<?php echo $monsterID; ?> "> <input type="submit" class="btn btn-success" name="Battle" value="<?php echo $dungeon1; ?> "> </form> </div> </div> </div> </div> <hr> <?php } $monsterListQuery->closeCursor(); }
<?php $timeStart = microtime(true); session_start(); if (empty($_SESSION)) { exit(header("Location: ../../index.php")); } require_once $_SESSION['File_Root'] . '/Kernel/Include.php'; require_once $_SESSION['File_Root'] . '/HTML/Header.php'; require_once 'Functions/SQL.php'; redirectToLogin($accountID, $linkRoot); redirectToBattle($verifyBattle, $linkRoot); hasAdmin($accountAccess); $monsterID = htmlspecialchars(addslashes($_POST['monsterID'])); $monster = newMonster($bdd, $monsterID); $monsterImage = $monster->getPicture(); $monsterName = $monster->getName(); $monsterDescription = $monster->getDescription(); $monsterLevel = $monster->getLevel(); $monsterStrength = $monster->getStrength(); $monsterDefense = $monster->getDefense(); $monsterHP = $monster->getHP(); $monsterMP = $monster->getMP(); $monsterMagic = $monster->getMagic(); $monsterAgility = $monster->getAgility(); $monsterExperience = $monster->getExperience(); $monsterGolds = $monster->getGold(); ?> <br> <div class="panel panel-warning">