Skip to content

Commit 5b94f42

Browse files
authored
Create form-handler2.php
1 parent ebc297b commit 5b94f42

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
$servername = "localhost";
3+
$username = "root";
4+
$password = "root";
5+
$dbname = "bootsity";
6+
// Create connection
7+
$conn = new mysqli($servername, $username, $password, $dbname);
8+
$username = $_POST["username"];
9+
$password = $_POST["password"];
10+
// prepare and bind
11+
$stmt = $conn->prepare('SELECT * FROM Users WHERE username = ? AND password = ?');
12+
$stmt->bind_param($username, $password);
13+
$stmt->execute();
14+
if (count($stmt) == 0) {
15+
echo 'Not Logged In';
16+
} else {
17+
echo 'Logged In';
18+
}
19+
$stmt->close();
20+
$conn->close();
21+
?>

0 commit comments

Comments
 (0)