A
A
Alex Oreshko2018-08-19 12:02:54
SQL
Alex Oreshko, 2018-08-19 12:02:54

How to implement 2 "requests" at the same time?

How to implement it correctly?

require_once '../engine/config.php';
  require_once '../engine/db.php';

header('Content-TYPE: application/json');
if(empty($_GET['name'])){echo 'error';}
if(empty($_GET2['password'])){echo 'error';}
else { 	
  $query = mysqli_query($connection, ("SELECT * FROM `users` WHERE `name`='".$_GET['name']."'"));
  $query2 = mysqli_query($connection, ("SELECT * FROM `users` WHERE `password`='".$_GET2['password']."'"));
  $result = mysqli_fetch_assoc($query, $query2);
  if($result) {
  $result = array(
    'name' => $result['name'],
    'tgdays' => $result['tgdays'],
    'hwid' => $result['hwid']
  );
  echo json_encode($result);
  }
  else{
    echo 'error';
  }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Bay, 2018-08-19
@kawabanga

1) sql injection. At least check it out.
2) $_GET - explore.
3) the answer to your question is
"SELECT * FROM `users` WHERE `name`=name and password= password.

A
Artem Spiridonov, 2018-08-19
@customtema

Write what you want to get as a result?
It looks like an imitation of the implementation of some task. Non-working implementation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question