[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Phpgroupware-developers] force users to change password ?
From: |
Brian Johnson |
Subject: |
Re: [Phpgroupware-developers] force users to change password ? |
Date: |
Tue, 24 May 2005 13:50:00 +0000 |
This is for Pascal Vilarem (and anyone else interested)
I found that ldap password change php script I couldn't find before
Here it is:
<?php
$renew = 10; # days (use seconds for phpgwlastpasswordchange)
#$attribute = "phpgwlastpasswordchange";
$attribute = "shadowlastchange";
$time_to_check = time()/60/60/24 - $renew;
$exempt = array( "jecinc" );
$ldap = ldap_connect("192.168.0.1");
$ds=$ldap;
if( $ldap)
{
$r=ldap_bind($ldap);
#echo "Bind result is " . $r . "<br />";
#echo "Searching for (sn=S*) ...";
// Search surname entry
$sr=ldap_search($ds, "ou=People,dc=example,dc=ca", "cn=*");
#print "Search result is $sr \n";
#print "Number of entires returned is ". ldap_count_entries($ds, $sr)
. "\n";
#echo "Getting entries ...\n";
$info = ldap_get_entries($ds, $sr);
#echo "Data for " . $info["count"] . " items returned:<p> \n";
for ($i=0; $i<$info["count"]; $i++)
{
if( $info[$i][$attribute][0] < $time_to_check && !
in_array($info[$i]["uid"][0],$exempt) )
{
#echo "dn is: " . $info[$i]["dn"] . "<br />\n";
#echo "$attribute is:". $info[$i][$attribute][0] .
"<br />\n";
#echo "first cn entry is: " . $info[$i]["cn"][0] .
"<br />\n";
#echo "first email entry is: " . $info[$i]["uid"][0] .
"<br /><hr />\n";
#system( "mail $info[$i]["uid"][0] -s 'Password change
reminder'" );
$message = "This email is to remind your to change
your password.\n";
$message .= "It has been at least $renew days since
you last changed your password\n";
$message .= "Please change your password in order to
discontinue recieving this daily reminder\n";
$message .= "Complex password selection and
semi-frequent changes is a major component of our system's security.\n";
mail($info[$i]["uid"][0], 'Password change reminder',
$message );
}
}
ldap_close($ds);
} else {
echo "<h4>Unable to connect to LDAP server</h4>";
}
?>
- Re: [Phpgroupware-developers] force users to change password ?,
Brian Johnson <=