<?php

if (isset($_POST['text'])){	
	$login = $_POST['login'];
	$password = $_POST['password'];
	$con=mysqli_connect("localhost:3306", "root", "506763", "workout");
	if (!$con)
		die('DB connection error');
	$query='SELECT * FROM users WHERE (user = ?) AND (password = ?);';
	$stmt = mysqli_prepare($con,$query);
	mysqli_stmt_bind_param($stmt,'s', $login, $password);
	mysqli_stmt_execute($stmt);
	mysqli_stmt_close($stmt);
	$stmt->store_result();
	if ($stmt->num_rows() = 1) {
		mysql_close($con);		
		echo 'done';
	}
} else {
		echo 'error';
}
