Browse Source

updated php after debug

visualTableRow
Michael Boeyens 3 years ago
parent
commit
b975e45b86
2 changed files with 30 additions and 6 deletions
  1. 22
    0
      .vscode/launch.json
  2. 8
    6
      index.php

+ 22
- 0
.vscode/launch.json View File

@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}

+ 8
- 6
index.php View File

@@ -23,7 +23,7 @@ td, th {
<body>
<?php
if (!$_POST['shot'] && $_POST['shot'] != '0') {
if (!isset($_POST['shot'])) {
$_SESSION['pos'] = rand(0, 20);
$_SESSION['ammo'] = 3;
} elseif ($_POST['shot'] == $_SESSION['pos']) {
@@ -46,11 +46,13 @@ td, th {
<?php
for($i=0; $i<21; $i++){?>
<th><?php
if (($_SESSION['pos'] == $i && $_POST['shot'] == $i) ||
($_SESSION['ammo'] == '0' && $_SESSION['pos'] == $i)){
?> X <?php
} elseif ($_POST['shot'] == $i) {
?> O <?php } ?>
if (isset($_POST['shot'])){
if (($_SESSION['pos'] == $i && $_POST['shot'] == $i) ||
($_SESSION['ammo'] == '0' && $_SESSION['pos'] == $i)){
?> X <?php
} elseif ($_POST['shot'] == $i) {
?> O <?php }
} ?>
</th><?php
} ?>
</tr>

Loading…
Cancel
Save