- //forward to next page
- if(!empty($_SESSION['ldapab']['lastlocation'])){
- header('Location: '.$_SESSION['ldapab']['lastlocation']);
- }else{
- header('Location: index.php');
- }
- exit;
+
+ //create private address book if simple enough
+ if(preg_match('/ou=([^,]+)$/',$conf['privatebook'],$match)){
+ $privatedn = $conf['privatebook'].', '.$_SESSION['ldapab']['binddn'];
+ if(!ldap_read($LDAP_CON,$privatedn,'')){
+ ldap_add($LDAP_CON,$privatedn,
+ array('objectClass' => array ('organizationalUnit','top'),
+ 'ou' => $match[1]));
+ }
+ }
+
+ //forward to next page
+ if(!empty($_SESSION['ldapab']['lastlocation'])){
+ header('Location: '.$_SESSION['ldapab']['lastlocation']);
+ }else{
+ header('Location: index.php');
+ }
+ exit;