TODO finish
This commit is contained in:
parent
7c17f4859c
commit
22c245f14d
14
20240926/char_check.php
Normal file
14
20240926/char_check.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$valid_input = $_POST['input_text'];
|
||||||
|
|
||||||
|
if (isset($_POST['input_char'])){
|
||||||
|
$locations = array();
|
||||||
|
for ($i=0; $i < strlen($valid_input); $i++) {
|
||||||
|
if ($_POST['input_char'] == $valid_input[i]){
|
||||||
|
array_push($locations, $i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $locations[0];
|
||||||
|
}
|
5
20240926/elsolap.php
Normal file
5
20240926/elsolap.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<input type="text" maxlength="10" name="input_text"><br>
|
||||||
|
<button type="submit">Ellenőrzés</button><br>
|
||||||
|
<?php
|
||||||
|
include "input_check.php";
|
||||||
|
?>
|
0
20240926/harmadikoldal.php
Normal file
0
20240926/harmadikoldal.php
Normal file
9
20240926/header.php
Normal file
9
20240926/header.php
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
23
20240926/index.php
Normal file
23
20240926/index.php
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
include "header.php";
|
||||||
|
include "input_check.php";
|
||||||
|
?>
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
Játék
|
||||||
|
</h1>
|
||||||
|
<form method="POST">
|
||||||
|
<?php
|
||||||
|
if (isset($valid_input)){
|
||||||
|
require "masodiklap.php";
|
||||||
|
} else{
|
||||||
|
require "elsolap.php";
|
||||||
|
} ?>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
if (isset($valid_input)){
|
||||||
|
include "char_check.php";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
9
20240926/input_check.php
Normal file
9
20240926/input_check.php
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
if (isset($_POST["input_text"]) ){
|
||||||
|
if (!str_contains($_POST["input_text"], " ")){
|
||||||
|
$valid_input = $_POST["input_text"];
|
||||||
|
global $valid_input;
|
||||||
|
} else {
|
||||||
|
echo "<h2>Nem szabad szóközt használni<h2>";
|
||||||
|
}
|
||||||
|
}
|
14
20240926/masodiklap.php
Normal file
14
20240926/masodiklap.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
include "input_check.php";
|
||||||
|
?>
|
||||||
|
<h2>
|
||||||
|
Adj meg egy karaktert!
|
||||||
|
</h2>
|
||||||
|
<form action="harnadikoldal.php">
|
||||||
|
<input type="text" maxlength="1" name="input_char"><br>
|
||||||
|
<button type="submit">Benne van e?</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
include "char_check.php";
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user