WebServ/www/public/M2/09/handle.php

46 lines
1.0 KiB
PHP
Raw Normal View History

2024-08-30 13:43:26 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>M2 08</title>
</head>
<body>
<?php
include("userManipulation.php");
if (isset($_POST["username"])) $username = $_POST["username"];
if (isset($_POST["password"])) $password = $_POST["password"];
$username = cleanData($username);
$user = new User($username, $password);
if (isset($_POST["login"])) {
if (isPresent($user)) {
echo "User: " . $user->getUsername();
echo "<br>Pass: " . $user->getPassword();
} else {
header("Location: index.php");
exit();
}
}
else if(isset($_POST["signup"])) {
addUser($user);
header("Location: index.php");
exit();
}
2024-09-06 13:22:36 +00:00
2024-08-30 13:43:26 +00:00
function cleanData($data)
{
$data = strip_tags($data);
$data = htmlspecialchars($data);
$data = trim($data);
$data = stripslashes($data);
return $data;
}
?>
</body>
</html>