commit f4ebd7b0d97f1244550ba985ee15df620f9d62e8
parent 9f8eead8e5f8b9d0ac39e9865ac92aa354aa8e8e
Author: Gerco van Woudenbergh <[email protected]>
Date: Tue, 21 Mar 2023 12:37:05 +0100
hashing passwords
Diffstat:
4 files changed, 110 insertions(+), 0 deletions(-)
diff --git a/form.html b/form.html
@@ -0,0 +1,24 @@
+<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>Awesome Form</title>
+</head>
+<body>
+
+<h1>Awesome form</h1>
+
+<form action="formtest.php" method="post">
+ <p>
+ <b>Naam:</b> <input type="text" name="naam" id="naam" placeholder="Naam komt hier">
+ <b>Email:</b> <input type="text" name="email" id="email" placeholder="E-mailadres">
+ <b>Formulier</b> <input type="file" name="bestand">
+ </p>
+
+ <p><input type="submit" name="submit" value="Ga los!"></p>
+
+</form>
+
+</body>
+</html>
diff --git a/formtest.php b/formtest.php
@@ -0,0 +1,11 @@
+<?php
+if ($_SERVER["REQUEST_METHOD"] == "POST") {
+ // collect value of input field
+ $name = $_POST['naam'];
+ if (empty($name)) {
+ echo "Name is empty";
+ } else {
+ echo $name;
+ }
+}
+?>
+\ No newline at end of file
diff --git a/weerdata.css b/weerdata.css
@@ -0,0 +1,8 @@
+table {
+ border-collapse: collapse;
+ }
+
+ table, th, td {
+ border: 1px solid black;
+ }
+
+\ No newline at end of file
diff --git a/weerdata.php b/weerdata.php
@@ -0,0 +1,64 @@
+<?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());
+}
+
+$sql = "SELECT * FROM weerdata";
+$result = mysqli_query($conn, $sql);
+
+if (mysqli_num_rows($result) > 0) {
+ // output data of each row
+ echo"
+ <head> <link rel=\"stylesheet\" type=\"text/css\" href=\"weerdata.css\"> </head>
+ <table>" .
+ " <tr>
+ <th> data id </th>
+ <th> station naam </th>
+ <th> datum & tijd </th>
+ <th> gevalideerd </th>
+ <th> temp </th>
+ <th> dauwpunt </th>
+ <th> luchtdruk zeeniveau </th>
+ <th> luchtdruk stationniveau </th>
+ <th> zichtbaarheid </th>
+ <th> windsnelheid </th>
+ <th> neerslag </th>
+ <th> sneeuwdiepte </th>
+ <th> gebeurtenissen </th>
+ <th> bewolking </th>
+ <th> windrichting </th>
+ </tr>";
+ while($row = mysqli_fetch_assoc($result)) {
+ echo"<tr>" .
+ "<td>" . $row["data_id"]. "</td>" .
+ "<td>" . $row["station_name"] . "</td>" .
+ "<td>" . $row["datum_tijd"]. "</td>" .
+ "<td>" . $row["gevalideerd"]. "</td>" .
+ "<td>" . $row["temp"]. "</td>" .
+ "<td>" . $row["dauwpunt"]. "</td>" .
+ "<td>" . $row["ldrk_znv"]. "</td>" .
+ "<td>" . $row["ldrk_station"]. "</td>" .
+ "<td>" . $row["zichtbaarheid"]. "</td>" .
+ "<td>" . $row["windsnelheid"]. "</td>" .
+ "<td>" . $row["neerslag"]. "</td>" .
+ "<td>" . $row["sneeuwdpt"]. "</td>" .
+ "<td>" . $row["gebeurtenissen"]. "</td>" .
+ "<td>" . $row["bewolking"]. "</td>" .
+ "<td>" . $row["windrichting"]. "</td>" .
+ "</tr>";
+ }
+ echo"</table>";
+} else {
+ echo "0 results";
+}
+
+mysqli_close($conn);
+?>
+\ No newline at end of file