-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathauth.php
More file actions
executable file
·43 lines (38 loc) · 1.12 KB
/
auth.php
File metadata and controls
executable file
·43 lines (38 loc) · 1.12 KB
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
40
41
42
43
<?php
if (!$link = mysql_connect('localhost', 'root', 'Moody_22')) {
echo 'Could not connect to mysql';
exit;
}
if (!mysql_select_db('FablabAuto', $link)) {
echo 'Could not select database';
exit;
}
$sql = 'SELECT m_id FROM member WHERE RFID_tag = "'.(string)$_GET['q'].'"';
$result = mysql_query($sql, $link);
if (!$result) {
echo "DB Error, could not query the database\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
if(!mysql_num_rows($result)) {
echo "C\n";
$sql2 = 'INSERT INTO logins(m_logged, login_time, login_cost) VALUES ("2", now(), "100")';
$result2 = mysql_query($sql2, $link);
if (!$result2) {
echo "DB Error, could not query the database\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
}
while ($row = mysql_fetch_assoc($result)) {
$sql2 = 'INSERT INTO logins(m_logged, login_time, login_cost) VALUES ("'.(string)$row['m_id'].'", now(), "100")';
$result2 = mysql_query($sql2, $link);
if (!$result2) {
echo "DB Error, could not query the database\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
echo "O\n";
}
mysql_free_result($result);
?>