creation should work but is untested

This commit is contained in:
katagia 2003-06-01 15:11:11 +00:00
parent 20f6553bb4
commit 722ec7dbbe
2 changed files with 37 additions and 18 deletions

View File

@ -479,7 +479,9 @@ switch ($select_local) {
echo '></td></tr>'; echo '></td></tr>';
break; break;
case 'host' : case 'host' :
echo '<input name="f_unix_password_no" type="hidden" value="'. $_SESSION['account']->unix_password_no) . '">'; echo '<input name="f_unix_password_no" type="hidden" value="';
if ($_SESSION['account']->unix_password_no) echo 'checked';
echo '">';
echo '<tr><td>'; echo '<tr><td>';
echo _('Password'); echo _('Password');
echo '</td><td></td><td>'; echo '</td><td></td><td>';

View File

@ -45,14 +45,18 @@ echo '</title>
echo '<table rules="all" class="masscreate" width="100%"> echo '<table rules="all" class="masscreate" width="100%">
<tr><td></td></tr>'; <tr><td></td></tr>';
if ($_POST['tolist']) $select = 'list';
if ($_POST['back']) $select = 'main';
if ($_POST['cancel']) $select = 'cancel';
if ($_POST['create']) $select = 'create';
if ($_POST['pdf']) createpdf($_SESSION['accounts']);
if (!$select) $select='main'; if (!$select) $select='main';
switch ($select) { switch ($select) {
case 'main': case 'main':
// if session was started previos, the existing session will be continued // if session was started previos, the existing session will be continued
$profilelist = getUserProfiles(); $profilelist = getUserProfiles();
if ( !session_is_registered("accounts")) session_register("accounts");
if (!is_object($accounts)) $accounts = array();
echo '<input name="select" type="hidden" value="main">'; echo '<input name="select" type="hidden" value="main">';
echo '<tr><td>'; echo '<tr><td>';
echo _('Mass Creation'); echo _('Mass Creation');
@ -75,13 +79,15 @@ switch ($select) {
<input type="hidden" name="MAX_FILE_SIZE" value="100000">'; <input type="hidden" name="MAX_FILE_SIZE" value="100000">';
echo _('Select file:'); echo _('Select file:');
echo '</td><td><input name="userfile" type="file"></td></tr> echo '</td><td><input name="userfile" type="file"></td></tr>
<tr><td><input type="submit" value="'; echo _('Commit'); echo '">'; <tr><td><input name="tolist" type="submit" value="'; echo _('Commit'); echo '">';
echo '</td></tr>'; echo '</td></tr>';
break; break;
case 'list': case 'list':
if ( session_is_registered("accounts")) session_unregister("accounts");
session_register("accounts");
if (!is_array($accounts)) $accounts = array();
$handler = fopen($_FILES['userfile']->tmp_name, 'r'); $handler = fopen($_FILES['userfile']->tmp_name, 'r');
$error=false; $error=false;
echo '<input name="select" type="hidden" value="list">';
echo '<tr><td>'; echo '<tr><td>';
echo _('Confirm List'); echo _('Confirm List');
echo '</td></tr>'; echo '</td></tr>';
@ -154,21 +160,32 @@ switch ($select) {
echo '</td><td><input name="create" type="submit" value="'; echo _('Create'); echo '">'; echo '</td><td><input name="create" type="submit" value="'; echo _('Create'); echo '">';
break; break;
case 'cancel': case 'cancel':
echo '<input name="select" type="hidden" value="cancel">'; echo '<meta http-equiv="refresh" content="0; URL=lists/listusers.php">';
break; break;
case 'create': case 'create':
echo '<input name="select" type="hidden" value="create">'; $row=0;
while ($row < sizeof($_SESSION['accounts'] $row!=-1) {
break; if (getgid($_SESSION['accounts'][$row]->general_group)==-1) {
case 'finish': $group = new account();
echo '<input name="select" type="hidden" value="finish">'; $group->general_username=$_SESSION['accounts'][$row]->general_group;
$group->general_uidNumber=checkid($_SESSION['accounts'][$row], 'group');
break; $group->general_gecos=$_SESSION['accounts'][$row]->general_group;
case 'pdf': creategroup($_SESSION['accounts'][$row]);
echo '<input name="select" type="hidden" value="pdf">'; }
$error = createuser($_SESSION['accounts'][$row]);
break; if ($error==1) $row++;
else {
$row = -1;
StatusMessage('ERROR', _('Could not create user'), _('Was unable to create ').$_SESSION['accounts'][$row]->general_username);
}
if ($row=-1) echo '<tr><td><input name="cancel" type="submit" value="'; echo _('Cancel'); echo '">';
else {
echo '<tr><td>';
echo _('All Users have been created');
echo '</td></tr><tr><td>';
echo '<tr><td><input name="cancel" type="submit" value="'; echo _('Mainmenu'); echo '">';
echo '<tr><td><input name="pdf" type="submit" value="'; echo _('Create PDF-File'); echo '">';
break;
} }