mirror of
https://codeberg.org/ThisIsMiseryy/techstore
synced 2026-05-14 14:52:04 +00:00
50 lines
1.9 KiB
PHP
50 lines
1.9 KiB
PHP
<?php
|
|
include 'db_conf.php';
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="it">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Registrazione - TechStore</title>
|
|
<link rel="stylesheet" href="style.css">
|
|
</head>
|
|
<body>
|
|
<?php
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$sql = "INSERT INTO Users (Name, Surname, Email, Password) VALUES (?, ?, ?, ?)";
|
|
if($stmt = $conn->prepare($sql)){
|
|
$stmt->bind_param("ssss", $name, $surname, $email, $password);
|
|
|
|
$name = $_POST['name'];
|
|
$surname = $_POST['surname'];
|
|
$email = $_POST['email'];
|
|
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
|
|
$stmt->execute();
|
|
|
|
echo "<p style='color: green; text-align: center;'>Registrazione avvenuta con successo! <a href=\"login.php\">Accedi</a></p>";
|
|
}
|
|
else{
|
|
echo "Errore: " . $conn->error;
|
|
}
|
|
}
|
|
?>
|
|
|
|
<form action="" method="POST">
|
|
<h2>Registrazione</h2>
|
|
<label for="name">Nome:</label>
|
|
<input type="text" id="name" name="name" required><br>
|
|
<label for="surname">Cognome:</label>
|
|
<input type="text" id="surname" name="surname" required><br>
|
|
<label for="email">Indirizzo e-mail:</label>
|
|
<input type="email" id="email" name="email" required><br>
|
|
<label for="password">Password:</label>
|
|
<input type="password" id="password" name="password" required><br>
|
|
<label for="confirm_password">Conferma password:</label>
|
|
<input type="password" id="confirm_password" name="confirm_password" required><br><br>
|
|
<button type="submit">Registrati</button>
|
|
<p style="text-align: center;">Hai già un account? <a href="login.php">Accedi</a></p>
|
|
</form>
|
|
</body>
|
|
</html>
|