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