Added a simple webserver with a batch start script

This commit is contained in:
MaciejkaG 2024-01-10 09:59:37 +01:00
commit fcc06a1d54
5 changed files with 62 additions and 0 deletions

18
public/index.php Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Strona PHP</title>
</head>
<body>
<h1>Ta strona działa na PHP</h1>
<p>
Dzisiejsza data: <?php echo date("Y/m/d"); ?> <br>
2+4 = <?php echo 2 + 4; ?> <br>
Twój adres IP: <?php echo $_SERVER['REMOTE_ADDR']; ?><br>
Wersja PHP na serwerze: <?php echo phpversion(); ?>
</p>
</body>
</html>

14
public/login.html Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login PHP</title>
</head>
<body>
<form action="login.php" method="post">
<input type="password" name="password">
<input type="submit" value="Wyślij">
</form>
</body>
</html>

17
public/login.php Normal file
View File

@ -0,0 +1,17 @@
<p>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// collect value of input field
$pass = $_POST['password'];
if ($pass=="1p1t.24") {
echo "Hasło poprawne! :D";
} else {
echo "Hasło niepoprawne :(";
}
echo "<br><a href=\"login.html\">Kliknij by wrócić do logowania</a>";
} else {
http_response_code(400);
}
?>
</p>

7
public/php-error.log Normal file
View File

@ -0,0 +1,7 @@
[10-Jan-2024 08:47:18 UTC] PHP Fatal error: Uncaught Error: Undefined constant "“REMOTE_ADDR”" in /zpool/shared/www12087/site26679/public/aplint/index.php:14
Stack trace:
#0 {main}
thrown in /zpool/shared/www12087/site26679/public/aplint/index.php on line 14
[10-Jan-2024 08:56:40 UTC] PHP Parse error: Unclosed '{' on line 3 does not match ')' in /zpool/shared/www12087/site26679/public/aplint/login.php on line 6
[10-Jan-2024 08:57:21 UTC] PHP Parse error: syntax error, unexpected token "}", expecting "," or ";" in /zpool/shared/www12087/site26679/public/aplint/login.php on line 13
[10-Jan-2024 08:57:26 UTC] PHP Parse error: syntax error, unexpected token "}", expecting "," or ";" in /zpool/shared/www12087/site26679/public/aplint/login.php on line 13

6
server.bat Normal file
View File

@ -0,0 +1,6 @@
@echo off
php -S localhost:3000 -t public/
echo:
echo Serwer zakonczyl prace
pause