Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include_once('config/config.php');
- class User{
- private $db;
- public function __construct() {
- $this->db = new Connection();
- $this->db = $this->db->dbConnect();
- }
- public function Login($name, $pass) {
- if(!empty($name) && !empty($pass)){
- $st = $this->db->prepare("SELECT * FROM users WHERE user=? AND pass=?");
- $st->bindParam(1, $name);
- $st->bindParam(1, $pass);
- $st->execute();
- if($st->rowCount() == 1){
- header('Location: admin/index.php');
- } else {
- $_SESSION['errortext'] = '<div class="error_login">Nieprawidłowy login lub hasło!</div>';
- header('Location: login.php');
- }
- } else {
- $_SESSION['errortext'] = '<div class="error_login">Wpisz swoją nazwę użytkownika oraz hasło!</div>';
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement