-
Notifications
You must be signed in to change notification settings - Fork 0
/
userchk.php
29 lines (27 loc) · 966 Bytes
/
userchk.php
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
<?php
global $barcode; global $userGot;
require $_SERVER['DOCUMENT_ROOT'].'/ramira/connect.inc.php';
if(isset($_GET['barcode']) && !empty($_GET['barcode']))
{
$barcode = $_GET['barcode'];
$que = $connect -> query("SELECT `username`, `password` FROM `utilizatori` WHERE `barcode` = '$barcode'");
}
else if(isset($_GET['username']) && !empty($_GET['username']) && isset($_GET['password']) && !empty($_GET['password']))
{
$userGot = $_GET['username'];
$passGot = $_GET['password'];
$que = $connect -> query("SELECT `username`, `password` FROM `utilizatori` WHERE `username` = '$userGot'");
}
$row = $que->fetch_assoc();
$username = $row['username'];
$password = $row['password'];
if($barcode != '') echo 'OK^'.$username.'^'.$password;
else if($userGot != '')
{
if($password == $passGot)echo 'OK^'.$username.'^'.$password;
else echo 'Wrong password';
}
//}
//else echo 'MYSQL ERROR!!\n'.$que_error();
$connect->close();
?>