function all_games_from_file() { $data = $GLOBALS['website_root_path'] . "/items/free_games/games.data"; $lines = file($data); foreach ($lines as $line) { $line = rtrim($line); game($line); } }
<?php require_once "modules/index.php"; require_once "modules/game.php"; $query = $_SERVER['QUERY_STRING']; $query = split("/", $query); $module = array_shift($query); $parameters = $query; switch ($module) { case "g": //game game($parameters); break; case "help": //help functions break; default: index($parameters); }
<body> <table id="myTable" class="table table-striped"> <thead><tr><th>Jeux Vidéos</thead></tr></th> <?php // Tableau $jeuxVideos = array('<a href = "http://eu.battle.net/wow/fr/">World of warcraft</a> ', '<a href="https://warthunder.com/fr">War Thunder</a> ', '<a href="http://www.rockstargames.com/grandtheftauto/">Grand Theft Auto</a> ', '<a href="http://www.jeuxvideo.com/jeux/pc/00028037-the-elder-scrolls-v-skyrim.htm">Skyrim</a> ', '<a href="http://www.smitegame.com/">SMITE</a> ', '<a href="http://southpark.cc.com/games/stick-of-truth">South Park: the stick of the truth</a> ', '<a href="http://buy.thewitcher.com/?lang=fr&country=FR">The Witcher</a> ', '<a href="http://eu.battle.net/d3/fr/">Diablo 3</a> ', '<a href="https://www.easports.com/fr/fifa">FIFA</a> ', '<a href="http://www.zelda.com/universe/?ref=https://www.google.fr/">Zelda</a> ', '<a href="http://www.metalgearsolid.be/">Metal Gear Solid</a>', '<a href="http://www.battlefield.com/fr_FR/">Battlefield</a>', '<a href="https://www.ubisoft.com/fr-FR/game/splinter-cell-blacklist">Splinter Cell</a>', '<a href="http://rocketleague.psyonix.com/">Rocket League</a>', '<a href="http://www.tombraider.com/landing/">Tomb Raider</a>', '<a href="http://www.unchartedthegame.com/en-us/">Uncharted</a>', '<a href="http://www.teamfortress.com/">Team Fortress 2</a>', '<a href="http://masseffectuniverse.fr/">Mass Effect</a>', '<a href="https://www.halowaypoint.com/fr-fr">Halo</a>', '<a href="http://www.jeuxvideo.com/jeux/playstation-3-ps3/00017189-prince-of-persia.htm">Prince of Persia</a>', '<a href="http://rainbow6.ubi.com/siege/fr-fr/home/">Rainbow Six</a>', '<a href="https://www.2kgames.com/bioshock/">bioshock</a>', '<a href="http://www.jeuxvideo.com/jeux/pc/00040060-the-walking-dead-saison-1.htm">The Walking Dead</a>', '<a href="https://www.ubisoft.com/fr-FR/game/rayman-legends/">Rayman</a>', '<a href="https://www.fallout4.com/">Fallout</a>', '<a href="https://godofwar.playstation.com/">God of war</a>', '<a href="https://fr.aion.gameforge.com/website/">Aion</a>', '<a href="https://www.residentevil.net/en/">Resident Evil</a>', '<a href="http://tetris.com/">Tetris</a>', '<a href="https://www.nintendo.fr/index.html">Mario</a>', '<a href="http://crashland.elynx.fr/">Crash Bandicoot</a>', '<a href="http://www.nintendo64ever.com/accueil.html">Goldeneye</a>', '<a href="http://www.gran-turismo.com/fr/">Gran Turismo</a>', '<a href="http://www.ageofempires.com/">Age of empire</a>', '<a href="http://littlebigplanet.playstation.com/fr">Little Big Planet</a>', '<a href="http://suckerpunch.playstation.com/">Infamous</a>'); // fonction function game($jeuxVideos) { echo "<tr><td>" . $jeuxVideos . "</td></tr>"; } // Boucle for ($i = 0; $i < count($jeuxVideos); $i++) { game($jeuxVideos[$i]); } ?> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> <script src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#myTable').DataTable();
<?php $inputFile = fopen("game_of_thrones_1.txt", "r") or die("Unable to open file!"); $data = array(); while (!feof($inputFile)) { $data[] = fgets($inputFile); } fclose($inputFile); for ($i = 0; $i < count($data); $i++) { echo game(trim($data[$i])), "\n"; } function game($str) { $result = array(); $flag = 0; for ($i = 0; $i < strlen($str); $i++) { $result[$str[$i]][] = $str[$i]; } foreach ($result as $item) { if (count($item) % 2 != 0) { $flag++; } } echo $flag > 1 ? "NO" : "YES"; }
</div> <div class="col-md-12"> <?php $myGames = array("World of warcraft", "League of Legends", "S4 League", "Summoner War", "Final fantasy", "Aion", "Pokemon Rubis omega/Saphir Alpha", "Xenoblade chronicles", "Pangya", "Witcher III", "Arche Blade", "Star Online", "Diablo", "Overwatch", "Smite", "Tekken", "Street fighter"); function game($myGame) { ?> <tr><td> <?php echo $myGame; ?> </td></tr> <?php } ?> <table id="gameTable" class="display" cellspacing="0"> <thead> <th>Jeux Vidéos</th> </thead> <tbody> <?php for ($i = 0; $i < count($myGames); $i++) { game($myGames[$i]); } ?> </tbody> </table> </div> </div> </body> </html>
<html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('number', 'Seuil'); data.addColumn('number', 'Nombre de tour'); data.addRows([ <?php for ($i = 1; $i <= 100; $i++) { $total_test = 0; for ($y = 1; $y <= $nb_test; $y++) { $total_test += game($i); } $moyenne = $total_test / $nb_test; echo '[' . $i . ', ' . $moyenne . '],'; } ?> ]); var options = { hAxis: {title: 'Seuil', gridlines: {count:40}, }, vAxis: {title: 'Nombre de tour'} }; var chart = new google.visualization.AreaChart(document.getElementById('chart_div')); chart.draw(data, options); }