accesslevel != 'Admin') { header('Location: ../login.php'); } $database = new Database(DB_HOST, DB_NAME, DB_USER, DB_PASS, DB_PORT, DB_SCMA); $dbconn = $database->getConn(); $acc_obj = new access_group_Class($dbconn, $_SESSION['user']->id); $acc_grp = $acc_obj->getRowsArr(); if(isset($_POST['submit'])&&!empty($_POST['submit'])){ $usr_obj = new user_Class($dbconn, $_SESSION['user']->id); $_POST['ftp_user'] = ''; if(empty($_POST['groups'])){ $_POST['groups'] = array(1); // give new admin Default group for now } $newId = $usr_obj->create($_POST); if($newId > 0){ if($_POST['accesslevel'] == 'Admin'){ $myuser_result = $usr_obj->getById($newId); $myuser = pg_fetch_assoc($myuser_result); pg_free_result($myuser_result); $email_user = explode('@', $_POST['email'])[0]; $_POST['ftp_user'] = $email_user.$newId; user_Class::create_ftp_user($_POST['ftp_user'], $_POST['email'], $myuser['password']); // create def access group for new admin $def_grp = array('name' => $_POST['ftp_user'], 'userids' => array($newId)); $acc_obj = new access_group_Class($dbconn, $newId); $grp_id = $acc_obj->create($def_grp); if($grp_id > 0){ $_POST['id'] = $newId; $_POST['groups'] = array($grp_id); $usr_obj->update($_POST); } } header("Location: users.php"); }else{ echo "Something Went Wrong"; } } ?>
Access Groups: $name){ ?>

 

× Note: Be sure to set the Access Level for the user.