added session
This commit is contained in:
parent
22c245f14d
commit
6b33de27f0
|
@ -1,14 +1,18 @@
|
|||
<?php
|
||||
|
||||
$valid_input = $_POST['input_text'];
|
||||
$valid_input = $_SESSION["valid_input"];
|
||||
|
||||
if (isset($_POST['input_char'])){
|
||||
$locations = array();
|
||||
for ($i=0; $i < strlen($valid_input); $i++) {
|
||||
if ($_POST['input_char'] == $valid_input[i]){
|
||||
if ($_POST['input_char'] == $valid_input[$i]){
|
||||
array_push($locations, $i);
|
||||
}
|
||||
}
|
||||
$_SESSION["locations"] = $locations;
|
||||
|
||||
echo $locations[0];
|
||||
foreach ($_SESSION["locations"] as $key => $value) {
|
||||
echo "<p>".$_POST['input_char'].": $value </p>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
<?php
|
||||
|
||||
?>
|
||||
<input type="text" maxlength="10" name="input_text"><br>
|
||||
<button type="submit">Ellenőrzés</button><br>
|
||||
<?php
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -6,4 +8,5 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
include "header.php";
|
||||
include "input_check.php";
|
||||
?>
|
||||
<body>
|
||||
<h1>
|
||||
|
@ -8,16 +7,18 @@
|
|||
</h1>
|
||||
<form method="POST">
|
||||
<?php
|
||||
if (isset($valid_input)){
|
||||
if (isset($_SESSION["valid_input"])){
|
||||
require "masodiklap.php";
|
||||
} else{
|
||||
require "elsolap.php";
|
||||
} ?>
|
||||
</form>
|
||||
<?php
|
||||
if (isset($valid_input)){
|
||||
/*
|
||||
if (isset($_SESSION["valid_input"])){
|
||||
include "char_check.php";
|
||||
}
|
||||
*/
|
||||
?>
|
||||
</body>
|
||||
</html>
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
if (isset($_POST["input_text"]) ){
|
||||
if (!str_contains($_POST["input_text"], " ")){
|
||||
$valid_input = $_POST["input_text"];
|
||||
global $valid_input;
|
||||
$_SESSION["valid_input"] = $_POST["input_text"];
|
||||
} else {
|
||||
echo "<h2>Nem szabad szóközt használni<h2>";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
<?php
|
||||
include "input_check.php";
|
||||
?>
|
||||
<h2>
|
||||
Adj meg egy karaktert!
|
||||
</h2>
|
||||
|
|
16
20240926/style.css
Normal file
16
20240926/style.css
Normal file
|
@ -0,0 +1,16 @@
|
|||
body{
|
||||
background-color: chocolate;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
h1, h2, p, form{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
p{
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
button{
|
||||
margin-top: 1rem;
|
||||
}
|
Loading…
Reference in New Issue
Block a user