Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Config{
- public function connect(){
- $localhost = 'localhost';
- $user = 'root';
- $password = '';
- $database = 'moon';
- mysqli_connect($localhost,$user,$password,$database);
- }
- }
- class Auth extends Config{
- public function login(){
- if(isset($_POST['login'])){
- $email = $_POST['email'];
- $password = $_POST['password'];
- $mysqli = $this->connect();
- $sql = mysqli_query($mysqli,"SELECT * FROM `users` WHERE `email` = '$email'");
- $userinfo = mysqli_fetch_array($sql);
- if($email == $userinfo['email'] && $password == $userinfo['password']){
- header('Location: index');
- $_SESSION['email'] = $email;
- }else{
- echo "Вы ввели неверные данные!";
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement