+}}
+
+ function change_pass_forced($uid,$pass) {
+
+ $c = ldap_connect("localhost");
+ $adminpw = "abcd123";
+ $admindn = "cn=kyberia,ou=Directory Administrators,dc=h-k,dc=sk";
+
+ if ($c) {
+ $this->dn = "ou=People,dc=h-k,dc=sk";
+ $this->values = array("dn");
+ $this->filter = "hkid=".$uid;
+
+ $sr = ldap_search($c, $this->dn, $this->filter, $this->values);
+
+ $res = ldap_get_entries($c, $sr);
+ $this->dn = $res[0]["dn"];
+
+ if ($res['count'] != 1) {
+ return false;
+ }
+
+ $b = ldap_bind($c, $admindn, $adminpw);
+// echo "changing password to ".$this->dn."";
+ if ($b) {
+ $this->ldif['userpassword'] = "{SHA}".base64_encode(pack("H*", sha1($pass)));
+ $mod_ret = ldap_modify($c, $this->dn, $this->ldif);
+ return $mod_ret;
+ }
+
+ return false;
+