12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <html>
- <?php
- session_start();
- var_dump($_SESSION);
-
- ?>
-
- <head>
-
- </head>
-
- <body>
- <h1 id="shot">Zeeslag</h1>
- <?php
-
- if ($_SESSION['sub']) {
- $sub = $_SESSION['sub'];
- } else {
- $canal = 5;
- $sub = rand(0, $canal - 1);
- $_SESSION['sub'] = $sub;
- $ammo = $canal / 5;
- }
- echo "Sub position: " . $sub;
- ?>
- <h2 id="shot">Invoer</h2>
- <form action="index.php" method="POST">
- <label for="name">Wat is uw schot?</label>
- <input type="text" name="shot" width="10" />
- <input type="submit" />
- </form>
-
- <?php
-
- if ($_POST) {
-
- $shot = $_POST['shot'];
- if ($shot == $sub) {
- echo 'Gewonnen';
- ?> <br /><a href="/">Reset Game</a><?php
- } else {
- echo "Gemist";
- }
- }
-
- ?>
- </body>
-
- </html>
|