From: Marco van Beek Date: Thu, 20 May 2010 09:23:19 +0000 (+0200) Subject: more granular uid's to avoid conflicts X-Git-Tag: 0.7.2~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=33d9e3778b08305a74262b24c535ceca6e4cf5a3;p=contagged more granular uid's to avoid conflicts with more than one entry created per second. --- diff --git a/entry.php b/entry.php index 1520834..c14ff2d 100644 --- a/entry.php +++ b/entry.php @@ -130,8 +130,8 @@ function _saveData(){ $entry = $_REQUEST['entry']; $dn = $_REQUEST['dn']; //construct new dn - $now = time(); - $newdn = 'uid='.$now; + $new_uid = time().str_pad(mt_rand(0,99999999),8,"0", STR_PAD_LEFT); + $newdn = 'uid='.$new_uid; if (empty($_REQUEST['type'])) { $_REQUEST['type']='public'; } if($_REQUEST['type'] == 'private' && $conf['privatebook']){ $newdn .= ', '.$conf['privatebook'].', '.$_SESSION['ldapab']['binddn']; @@ -149,7 +149,7 @@ print ''; if(empty($dn)){ //new entry - $entry['uid'][] = $now; + $entry['uid'][] = $new_uid; $r = ldap_add($LDAP_CON,$newdn,$entry); tpl_ldaperror(); return $newdn;