From 3ec7bb774ab67caeadd2dcb8fe75033aab516839 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Thu, 4 Apr 2019 15:18:27 +0200 Subject: [PATCH] plop --- User.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ User_Ldap.php | 5 +++++ User_Manager.php | 14 ++++++++++++++ User_Sql.php | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 User.php create mode 100644 User_Ldap.php create mode 100644 User_Manager.php create mode 100644 User_Sql.php diff --git a/User.php b/User.php new file mode 100644 index 0000000..cfdecbb --- /dev/null +++ b/User.php @@ -0,0 +1,48 @@ +is_connected){ + return $this->id; + } + return false; + } + public function is_connected() + { + return $this->is_connected; + } + public function get_auth_method() + { + if($this->is_connected){ + return $this->auth_method; + } + return false; + } + public function get_groups() + { + return $this->groups; + } + public function set_db_obj($db){ + $this->db = $db; + return $this; + } + public function __construct($db){ + $this->db = $db; + } + + + + +} diff --git a/User_Ldap.php b/User_Ldap.php new file mode 100644 index 0000000..5ba5b3a --- /dev/null +++ b/User_Ldap.php @@ -0,0 +1,5 @@ +authentificate($login,$password)){ + return $user; + } + + return false; + } +} \ No newline at end of file diff --git a/User_Sql.php b/User_Sql.php new file mode 100644 index 0000000..8300d41 --- /dev/null +++ b/User_Sql.php @@ -0,0 +1,33 @@ +db,$login) . "' + AND password=SHA2('". mysqli_real_escape_string($this->db,$password) . "',512) + AND auth_method='local';"; + + $rs = $this->db->query($sql); + + if($r = $rs->fetch_array(MYSQLI_ASSOC)){ + $this->is_connected = true; + $this->display_name = $r["display_name"]; + $this->id = $r['id']; + $this->auth_method = 'sql'; + + return $this; + + }else{ + $this->is_connected = false; + return false; + + } + + return false; + } + +} \ No newline at end of file