note 86046 modified in function.ldap-mod-replace by thiago

From: Date: Tue, 29 Nov 2011 14:04:41 +0000
Subject: note 86046 modified in function.ldap-mod-replace by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-184781@lists.php.net to get a copy of this message
Here's an easy way to encode AD "unicodepwd" values from linux... Download and install recode... http://www.gnu.org/software/recode/recode.html Then write something like this... <?php function ADUnicodePwdValue($plain_txt_value) { return str_replace("\n", "", shell_exec("echo -n '\"" . $plain_txt_value . "\"' | recode latin1..utf-16le/base64")); } $user["unicodepwd"] = ADUnicodePwdValue("my_password"); ?> [EDITOR thiago NOTE: The following text was sent by boyvanderlaak at gmail dot com as an important complement] if you do not have access to your linux box but have Multibyte String enabled you could try the following for AD 2008: <?php $info["unicodePwd"] = mb_convert_encoding('"' . $newPassword . '"', 'utf-16le'); ?> --was-- Here's an easy way to encode AD "unicodepwd" values from linux... Download and install recode... http://www.gnu.org/software/recode/recode.html Then write something like this... <?php function ADUnicodePwdValue($plain_txt_value) { return str_replace("\n", "", shell_exec("echo -n '\"" . $plain_txt_value . "\"' | recode latin1..utf-16le/base64")); } $user["unicodepwd"] = ADUnicodePwdValue("my_password"); ?> http://php.net/manual/en/function.ldap-mod-replace.php

« previous php.notes (#184781) next »