Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once("connect/connection.php");
- class Logins
- {
- public $connect;
- function __constract()
- {
- $con = new Database;
- $connection=$con->dbConnection();
- $this->connect=$connection;
- }
- public function filter($username,$password)
- {
- $username = htmlspecialchars($username);
- $username = strip_tags($username);
- $password = htmlspecialchars($password);
- $password = md5($password)."~&(^m";
- $this->check($username,$password);
- }
- public function check($user,$pass)
- {
- $sql = "SELECT * FROM admin WHERE `user` = :user NAD `pass`= :pass";
- $result = $this->connect->prepare($sql);
- $result->bindParam(":user",$user);
- $result->bindParam(":pass",$pass);
- $result->execute();
- $num=$result->fetchColumn();
- if($num == 1)
- {
- $row = $result->fetchAll(PDO::FETCH_ASSOC);
- $_SESSION["Is_Login"]=$row["name"];
- }else{
- header("location: ops.php");
- exit();
- }
- }
- }
- $log = new Logins;
- if(isset($_POST["login"]))
- {
- $log->check($_POST["user"],$_POST["pass"]);
- }
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Untitled Document</title>
- </head>
- <body>
- <form method="post" action="<?php print_r(htmlspecialchars($_SERVER['PHP_SELF'])); ?>">
- <input type="text" name="user">
- <input type="text" name="pass">
- <input type="submit" value="login" name="login">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement