Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: user
- * Date: 2019-02-11
- * Time: 08:40
- */
- class Hack
- {
- protected $user;
- protected $attempt;
- protected $authentication;
- private function validate($data)
- {
- }
- private function connection()
- {
- $con = new PDO('hack_css_bd', 'brood', 'fuck');
- $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- return $con;
- }
- private function prepareStatement($sql){
- return $this->connection()->prepare($sql);
- }
- public function auth($user)
- {
- $sql = "SELECT * FROM users WHERE username = :username AND password = :password LIMIT 1";
- $stmt =$this->prepareStatement($sql);
- $stmt->bindValue( "username", $this->username, PDO::PARAM_STR );
- $stmt->bindValue( "password", hash("sha256", $this->password . $this->salt), PDO::PARAM_STR );
- if($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- session_start();
- //**
- return true;
- }else{
- return false;
- }
- }
- public function searchBook($fromPost){
- $this->validate($fromPost);
- $value=$fromPost->someValue;
- $query =$this->prepareStatement('SELECT id,name FROM table WHERE name LIKE ? LIMIT 10');
- $query->bindValue(1, "%$value%", PDO::PARAM_STR);
- if (!$query->rowCount() == 0) {
- }
- }
- }
Add Comment
Please, Sign In to add comment