Monday, January 11, 2010
Tech
Using Msn Messenger In Old Version
---
Step1 – Go to Msn Messenger program folder
Step2 – Find out msnmsgr.exe, right click it and select property
Step3 – Switch to compatibility page, and tick compatibility mode.
Step4 – Select Windows 2000, finally click OK
---
Change default language typing (Word)
---------
1. Open Word Program.
2. Go to "Tools" , "Options" , and select "Edit" tag.
3. Cancel IME options"'s "IME Control Active".
4. Finish
---------
Change language typing (System)
-------
1. Go to "regedit"
2. Go to "HKEY_CURRENT_USER , Keyboard layout , Preload"
3. Sorting your language sequence here
4. Finish
-------
Friday, January 8, 2010
Import SambaSamAccount Attribute to existing LDAP
---------------------------------------------------------
// Connecting to LDAP
$ldapconn = ldap_connect ($ldaphost, $ldapport)
or die("Could not connect to $ldaphost");
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
$dn="ou=Student,dc=newera,dc=edu,dc=my";
$filter="uid=testuser";
$justthese=array("description","uidnumber");
$sr=ldap_search($ldapconn,$dn,$filter,$justthese);
$info=ldap_get_entries($ldapconn,$sr);
print $info["count"]." entries returned
";
for($i=0; $i<$info["count"]; $i++)
{
//$aaa=$info[$i]["uid"][0];
//ldap_mod_add($ldapconn,"uid=" . $aaa .",ou=Student,dc=test3,dc=test2,dc=test1",$entry);
//echo $info[$i]["uid"][0]."
";
//$uuu = $info[$i]["uid"][0];
$kkk = $info[$i]["description"][0];
$mmm = $info[$i]["uidnumber"][0]*2+1000;
$nnn = "S-1-5-21-3242087124-4121386262-3365014982-";
$ppp = $nnn.$mmm;
echo $kkk;
//-------------------
$con = mysql_connect("$hostname","$username","$password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("studentemail", $con);
$result = mysql_query("SELECT * FROM student
WHERE student_id='$kkk'");
while($row = mysql_fetch_array($result))
{
$yyy = $row['student_ic'];
$zzz = rtrim(shell_exec("/usr/local/bin/mkntpwd -N $yyy"));
echo $row['student_ic'];
echo "
";
}
//--------------------
//add new attribute
$entry["objectClass"]="sambaSamAccount";
$entry["sambaSID"]=$ppp;
$entry["sambaDomainName"]="lab";
$entry["sambaAcctFlags"]="[U]";
$entry["sambaPwdLastSet"]="1262395503";
$entry["sambaNTPassword"]=$zzz;
ldap_mod_del($ldapconn,"uid=testuser,ou=Student,dc=test3,dc=test2,dc=test1",$entry);
}
?>
---------------------------------------------------------------------------------------------