Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $key = $_POST["key"];
- if ($key == "API_KEY") {
- $con = mysqli_connect("localhost","u5004881_fitrah","whoami123-.","u5004881_report_garena");
- if (mysqli_connect_errno()) {
- echo "Connect failed";
- exit();
- }
- $data = array();
- $username = $_POST["username"];
- $password = $_POST["password"];
- $kueri = "SELECT id, name, username, photo, position FROM users WHERE (username='$username' || email='$username' || phone_number='$username') AND password='$password'" ;
- $result = mysqli_query($con, $kueri);
- $num_user = mysqli_num_rows($result);
- if ($num_user==1) {
- $data["user"] = $result->fetch_assoc();
- $data["result"] = "success";
- }
- else {
- $data["result"] = "Username and Password not match";
- }
- header('Content-Type: application/json');
- echo json_encode($data);
- mysqli_close($con);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement