LDAP Account Manager



read()) { if (substr($jsEntry, strlen($jsEntry) - 3, 3) != '.js') continue; echo "\n"; } $cfg = new LAMCfgMain(); // check if submit button was pressed if ($_POST['submit']) { // check master password if (!$cfg->checkPassword($_POST['passwd'])) { $error = _("Master password is wrong!"); } // add new profile elseif ($_POST['action'] == "add") { if (preg_match("/^[a-z0-9_-]+$/i", $_POST['addprofile']) && !in_array($_POST['addprofile'], getConfigProfiles())) { // check profile password if ($_POST['addpassword'] && $_POST['addpassword2'] && ($_POST['addpassword'] == $_POST['addpassword2'])) { // create new profile file @copy("../../config/lam.conf_sample", "../../config/" . $_POST['addprofile'] . ".conf"); @chmod ("../../config/" . $_POST['addprofile'] . ".conf", 0600); $file = is_file("../../config/" . $_POST['addprofile'] . ".conf"); if ($file) { // load as config and write new password $conf = new LAMConfig($_POST['addprofile']); $conf->set_Passwd($_POST['addpassword']); $conf->save(); $msg = _("Created new profile."); } else $error = _("Unable to create new profile!"); } else $error = _("Profile passwords are different or empty!"); } else $error = _("Profile name is invalid!"); } // rename profile elseif ($_POST['action'] == "rename") { if (preg_match("/^[a-z0-9_-]+$/i", $_POST['renfilename']) && !in_array($_POST['renfilename'], getConfigProfiles())) { if (rename("../../config/" . $_POST['oldfilename'] . ".conf", "../../config/" . $_POST['renfilename'] . ".conf")) { $msg = _("Renamed profile."); } else $error = _("Could not rename file!"); } else $error = _("Profile name is invalid!"); } // delete profile elseif ($_POST['action'] == "delete") { if (preg_match("/^[a-z0-9_-]+$/i", $_POST['delfilename']) && @unlink("../../config/" . $_POST['delfilename'] . ".conf")) { $msg = _("Profile deleted."); } else $error = _("Unable to delete profile!"); } // set new profile password elseif ($_POST['action'] == "setpass") { if ($_POST['setpassword'] && $_POST['setpassword2'] && ($_POST['setpassword'] == $_POST['setpassword2'])) { $config = new LAMConfig($_POST['setprofile']); $config->set_Passwd($_POST['setpassword']); $config->save(); $config = null; $msg = _("New password set successfully."); } else $error = _("Profile passwords are different or empty!"); } // set default profile elseif ($_POST['action'] == "setdefault") { $configMain = new LAMCfgMain(); $configMain->default = $_POST['defaultfilename']; $configMain->save(); $configMain = null; $msg = _("New default profile set successfully."); } // print messages if (isset($error) || isset($msg)) { if (isset($error)) { StatusMessage("ERROR", $error); } if (isset($msg)) { StatusMessage("INFO", $msg); } } else exit; } // check if config.cfg is valid if (!isset($cfg->default)) { StatusMessage("ERROR", _("Please set up your master configuration file (config/config.cfg) first!"), ""); echo "\n\n"; die(); } ?>

 
   
   
 
 
 
 
 
 
     
 
   

 

:     ">