-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
26 lines (26 loc) · 752 Bytes
/
process.php
File metadata and controls
26 lines (26 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
if (isset($_POST["login"])) {
$username = $_POST['user'];
$password = $_POST['pass'];
$conn = mysqli_connect("localhost", "root", "", "project");
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$result = mysqli_query($conn, $sql);
if ($result) {
$row = mysqli_fetch_assoc($result);
if ($row) {
// Successful login
header("Location: data-entry.html");
exit();
} else {
echo "Failed to login!";
}
} else {
echo "Query failed: " . mysqli_error($conn);
}
mysqli_close($conn);
}
?>