-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.php
More file actions
39 lines (26 loc) · 831 Bytes
/
auth.php
File metadata and controls
39 lines (26 loc) · 831 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
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
function authenticate_user($username, $password) {
$results = "";
//$db = mysqli_connect("localhost", "system", "system");
$mysqli = new mysqli("localhost", "user_check", "userPass", "file_storage");
if ($mysqli -> connect_errno)
{
exit();
}
// Perform query
if ($result = $mysqli -> query("SELECT * FROM users WHERE UserName = '$username' AND Password = '$password'"))
{
$results = $result -> num_rows;
// Free result set
$result -> free_result();
}
$mysqli -> close();
//$db->select_db('file_storage');
//$query = "SELECT * FROM users WHERE user = '$username' AND password = '$password'";
//$result = $db->query($query);
//$results = $result->num_rows;
//$result->free();
//$db->close();
return $results;
}
?>