Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Login {
- private $sqlObject;
- private $host = 'localhost';
- private $user = 'root';
- private $pass = 'pass';
- private $db = 'db';
- function __construct() {
- $this->sqlObject = new mysqli($this->host, $this->user, $this->pass, $this->db);
- }
- function checkLogin($username, $password) {
- $get_info = $sqlObject->query("SELECT * FROM `users` WHERE
- `username` = '".$sqlObject->real_escape_string($username)."' &&
- `password` = '".$sqlObject->real_escape_string($password)."'");
- if($get_info->num_rows> == 1) {
- return 1;
- } else {
- return 0;
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment