iwa-panda1

Manage Weather Data by International Weather Agency (Version 1)
Log | Files | Refs

commit 7e00efafb8a3bed0fc3f7dc83e6ae4495b811194
parent ccc4be78817dd6267ad0fc59e903ec42f4933312
Author: Gerco van Woudenbergh <[email protected]>
Date:   Mon, 20 Mar 2023 16:48:43 +0100

user toevoegen

Diffstat:
Acrud_user.php | 29+++++++++++++++++++++++++++++
Aform.html | 33+++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/crud_user.php b/crud_user.php @@ -0,0 +1,29 @@ +<?php +$servername = "86.92.67.21"; +$username = "friedel"; +$password = "koffiemetzuiker"; +$dbname = "wap2"; +// Create connection +$conn = mysqli_connect($servername, $username, $password, $dbname); +// Check connection +if (!$conn) { + die("Connection failed: " . mysqli_connect_error()); +} + +if ($_SERVER["REQUEST_METHOD"] == "POST") { + // collect value of input field + $vname = $_POST['voornaam']; + $aname = $_POST['achternaam']; + $email = $_POST['email']; + $password = $_POST['password']; + $permissions = $_POST['permissions']; +} + + +$sql = "INSERT INTO medewerkers (voornaam, achternaam, email, wachtwoord, permissie_niveau) VALUES(?, ?, ?, ?, ?);"; +$stmt= $conn->prepare($sql); +$stmt->bind_param("sssss", $vname, $aname, $email, $password, $permissions); +$stmt->execute(); + +mysqli_close($conn); +?> diff --git a/form.html b/form.html @@ -0,0 +1,33 @@ +<html lang="nl"> +<head> + <meta charset="UTF-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>User toevoegen</title> +</head> +<body> + +<h1>User toevoegen</h1> + +<form action="crud_user.php" method="post"> + <p> + <b>Voornaam:</b> <input type="text" name="voornaam" id="voornaam" placeholder="Voornaam"> + <b>Achternaam:</b> <input type="text" name="achternaam" id="achternaam" placeholder="Email"> + <b>Email</b> <input type="text" name="email" id="email" placeholder="Email"> + <b>Wachtwoord</b> <input type="password" name="password" id="password" placeholder="******"> + <br> + <p>Please select the user permissions:</p> + <input type="radio" id="Admin" name="permissions" value="1"> + <label for="html">Admin</label><br> + <input type="radio" id="Administratief medewerker" name="permissions" value="2"> + <label for="Administratief medewerker">Administratief medewerker</label><br> + <input type="radio" id="Wetenschappelijk medewerker" name="permissions" value="3"> + <label for="Wetenschappelijk medewerker">Wetenschappelijk medewerker</label> + </p> + + <p><input type="submit" name="submit" value="Voeg toe"></p> + +</form> + +</body> +</html>