Introduce logging

Change-Id: I5ac91cc195a46d666714904b56e9f89f56f9c2c0
diff --git a/ldap.php b/ldap.php
index d73349f..637c54f 100755
--- a/ldap.php
+++ b/ldap.php
@@ -1,5 +1,8 @@
 <?php
 
+include_once "User.php";
+use \User as User;
+
 function debug($msg)
 {
         include 'config.php';
@@ -18,26 +21,6 @@
         return $string;
 }
 
-class User
-{
-        function __construct(string $user_name, string $first_name, string $last_name, string $email, string $password, string $organization)
-        {
-                $this->user_name = $user_name;
-                $this->name = $first_name;
-                $this->first_name = $first_name;
-                $this->last_name = $last_name;
-                $this->email = $email;
-                $this->organization = $organization;
-                if ($ENCRYPT_PASSWORDS) {
-                        $this->user_hash = "{crypt}" . crypt($password, '$6$' . generateSalt(10) . '$');
-                        # $this->user_hash = "{SHA}" .  base64_encode(sha1($password, true));
-                } else {
-                        $this->user_hash = "{CLEAR}" . $password;
-                }
-                $this->password = $this->user_hash;
-
-        }
-}
 
 function ldap_search_query($query, $filter = "cn")
 {
@@ -65,7 +48,7 @@
         return $data;
 }
 
-function ldap_add_user($user)
+function ldap_add_user(User $user)
 {
         include 'config.php';
         $ldap_host = $HOST;
@@ -116,7 +99,7 @@
 
         return $add;
 }
-function ldap_user_count($user)
+function ldap_user_count(string $user)
 {
         return ldap_search_query($user)["count"];
 }