Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Schattenjacht{
- function createArray(){
- $deuren = array();
- for ($i=0; $i < 7; $i++) {
- $deuren[$i] = 0;
- }
- $randINT = rand(0,6);
- $deuren[$randINT] = 2;
- return $deuren;
- }
- function showDeuren($deuren= array(), $url){
- $toEcho = '';
- foreach ($deuren as $key => $value) {
- if ($value == 0 || $value == 2) {
- $toEcho .= '<a href="treasurehunt.php/?door='.$key.'&'.$url.'"><img src="http://172.16.36.251/test/door.png"></a>'.$value;
- }
- }
- return $toEcho;
- }
- }
- if (!isset($_GET["door"])) {
- $deuren = new Schattenjacht;
- $arrayDeuren = $deuren->createArray();
- $url = '';
- foreach ($arrayDeuren as $key => $value) {
- $url .= $key .'='.$value;
- if ($key < 6) {
- $url .= '&';
- }
- }
- echo $url;
- $toEcho = $deuren->showDeuren($arrayDeuren, $url);
- }
- /*if ($_GET["reset"] == 1) {
- # code...
- }*/
- /*if (isset($_GET["kiesdeur"])) {
- # code...
- }*/
- ?>
- <html>
- <head>
- <title>Schattenjacht</title>
- </head>
- <body>
- <h1>Kies een deur</h1>
- <?=$toEcho?>
- <br>
- Klik <a href="treasurehunt.php?reset=1">hier</a> om een nieuw spel te beginnen.
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement