Hi all
I wrote this PHP script to get the id of the user if he type the user name (which is phone number) and password correctly:
then I wrote this code to check and verify the username and password:
the job always gives me success even if username or password is incorrect ..
where is the problem, is it in the php code ?
remark (username=0990400788 and password=12 is correct)
thanks in advance
I wrote this PHP script to get the id of the user if he type the user name (which is phone number) and password correctly:
B4X:
<?php
include('../includes/config.php');
$phone_no=$_GET["phone_no"];
$pw=$_GET["pw"];
$q="SELECT * FROM users WHERE phone_num='$phone_no' AND blocked='0' AND pw='$pw' ";
$result = $con->query($q);
// Mysql_num_row is counting table row
$count=mysqli_num_rows($result);
// If result matched $username and $password, table row must be 1 row
if($count==1){
$row = mysqli_fetch_assoc($result);
$_SESSION['phone_no']= "phone_no";
$_SESSION['pw']= "pw";
// echo "Login Successful";
print($row['id']);
return true;
}
else{
return false;
}
?>
then I wrote this code to check and verify the username and password:
B4X:
Dim lg As HttpJob
lg.Initialize("checklogin", Me)
Dim tl As String="11"
Dim pw As String="11"
ProgressDialogShow("verifying username and password")
lg.download("http://newg.com.sd/b4atest/users/login.php?phone_no=" & tl & "&pw=" & pw)
B4X:
Sub JobDone (Job As HttpJob)
ProgressDialogHide
Dim user_id As String
If Job.Success = True Then
Select Job.JobName
Case "checklogin"
user_id = Job.GetString
Msgbox("login successfully with the id " & user_id,"")
End Select
Else
Msgbox("invalid username or password","")
End If
Job.Release
End Sub
the job always gives me success even if username or password is incorrect ..
where is the problem, is it in the php code ?
remark (username=0990400788 and password=12 is correct)
thanks in advance