Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
- class Login
- {
- private $login;
- private $password;
- public function __construct($login, $password)
- {
- $this->login = $login;
- $this->password = $password;
- }
- public function login()
- {
- if (empty($_POST['username']) || empty($_POST['password'])) {
- echo 'wypelnij dane';
- } else {
- $connection = mysqli_connect("localhost", "root", "" , "football");
- $result = mysqli_query($connection, "SELECT * FROM user WHERE username = '{$this->login}' and password = '{$this->password}' limit 1");
- if (!$result) {
- die(" Error: " . mysqli_error($connection));
- }
- $check = mysqli_fetch_array($result);
- var_dump($check);
- }
- }
- }
- $user = new Login($_POST['username'], $_POST['password']);
- $user->login();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement