delete_user.php
changeset 71 e1b918eaf69a
parent 65 ce1c4d5e1576
child 73 8a239565e9b3
equal deleted inserted replaced
70:47248e2af079 71:e1b918eaf69a
    52                 clean_page($BASE_URL . $BASE_PATH . "users.php");
    52                 clean_page($BASE_URL . $BASE_PATH . "users.php");
    53         }
    53         }
    54         include_once("inc/header.inc.php");
    54         include_once("inc/header.inc.php");
    55         ?>
    55         ?>
    56 	
    56 	
    57     <h3><? echo _('Delete user'); ?> "<? echo get_fullname_from_userid($id) ?>"</h3>
    57     <h3><?php echo _('Delete user'); ?> "<?php echo get_fullname_from_userid($id) ?>"</h3>
    58      <form method="post">
    58      <form method="post">
    59         <?
    59         <?php
    60         $domains = get_domains_from_userid($id);
    60         $domains = get_domains_from_userid($id);
    61         if (count($domains) > 0) 
    61         if (count($domains) > 0) 
    62         {
    62         {
    63         	echo _('This user has access to the following zone(s)'); ?> :<BR><?
    63         	echo _('This user has access to the following zone(s)'); ?> :<BR><?php
    64                 $users = show_users($id);
    64                 $users = show_users($id);
    65                 if(count($users) < 1) 
    65                 if(count($users) < 1) 
    66                 {
    66                 {
    67                         $add = " CHECKED DISABLED";
    67                         $add = " CHECKED DISABLED";
    68                         $no_users = 1;
    68                         $no_users = 1;
    70                 ?>
    70                 ?>
    71                 <table>
    71                 <table>
    72                  <tr>
    72                  <tr>
    73 		  <td class="n">Delete</td>
    73 		  <td class="n">Delete</td>
    74 		  <td class="n">Name</td>
    74 		  <td class="n">Name</td>
    75 		<? if (!$no_users) { ?>
    75 		<?php if (!$no_users) { ?>
    76 		  <td class="n">New owner</td>
    76 		  <td class="n">New owner</td>
    77 		<? } ?>
    77 		<?php } ?>
    78 		 </tr>
    78 		 </tr>
    79                 <?
    79                 <?php
    80                 foreach ($domains as $d) 
    80                 foreach ($domains as $d) 
    81                 {
    81                 {
    82                         ?>
    82                         ?>
    83                  <tr>
    83                  <tr>
    84 		  <td class="n" align="center"><?
    84 		  <td class="n" align="center"><?php
    85                         if ($no_users) 
    85                         if ($no_users) 
    86                      	{ 
    86                      	{ 
    87                      		?><input type="hidden" name="delete[]" value="<? echo $d["id"] ?>"><?
    87                      		?><input type="hidden" name="delete[]" value="<?php echo $d["id"] ?>"><?php
    88                         } 
    88                         } 
    89                         ?><input type="checkbox"<? echo $add ?> name="delete[]" value="<? echo $d["id"] ?>"></td><td class="n"><? echo $d["name"] ?></td><td class="n"><? 
    89                         ?><input type="checkbox"<?php echo $add ?> name="delete[]" value="<?php echo $d["id"] ?>"></td><td class="n"><?php echo $d["name"] ?></td><td class="n"><?php 
    90                         if (!$no_users) 
    90                         if (!$no_users) 
    91                         { 
    91                         { 
    92                         	?><select name="domain[<? echo $d["id"] ?>]"><?
    92                         	?><select name="domain[<?php echo $d["id"] ?>]"><?php
    93                         	foreach($users as $u) 
    93                         	foreach($users as $u) 
    94                         	{
    94                         	{
    95                         	        ?><option value="<? echo $u["id"] ?>"><? echo $u["fullname"] ?></option><?
    95                         	        ?><option value="<?php echo $u["id"] ?>"><?php echo $u["fullname"] ?></option><?php
    96                         	}
    96                         	}
    97                         	?></select></td><? 
    97                         	?></select></td><?php 
    98                         } 
    98                         } 
    99                         ?></tr><?
    99                         ?></tr><?php
   100                 }
   100                 }
   101                 ?></table><?
   101                 ?></table><?php
   102         }
   102         }
   103         
   103         
   104         $message = _('You are going to delete this user, are you sure?');
   104         $message = _('You are going to delete this user, are you sure?');
   105         if(($numrows = $db->queryOne("SELECT count(id) FROM zones WHERE owner=".$db->quote($id))) != 0)
   105         if(($numrows = $db->queryOne("SELECT count(id) FROM zones WHERE owner=".$db->quote($id))) != 0)
   106         {
   106         {
   107         	$message .= " " . _('This user has access to ') . $numrows . _(' zones, by deleting him you will also delete these zones.');
   107         	$message .= " " . _('This user has access to ') . $numrows . _(' zones, by deleting him you will also delete these zones.');
   108         }
   108         }
   109 
   109 
   110         ?>
   110         ?>
   111         <font class="warning"><? echo $message ?></font><br>
   111         <font class="warning"><?php echo $message ?></font><br>
   112         <input type="hidden" name="id" value="<? echo $id ?>">
   112         <input type="hidden" name="id" value="<?php echo $id ?>">
   113         <input type="hidden" name="confirm" value="1">
   113         <input type="hidden" name="confirm" value="1">
   114         <input type="submit" class="button" value="<? echo _('Yes'); ?>"> <input type="button" class="button" OnClick="location.href='users.php'" value="<? echo _('No'); ?>"></FORM>
   114         <input type="submit" class="button" value="<?php echo _('Yes'); ?>"> <input type="button" class="button" OnClick="location.href='users.php'" value="<?php echo _('No'); ?>"></FORM>
   115         <?
   115         <?php
   116         include_once("inc/footer.inc.php");
   116         include_once("inc/footer.inc.php");
   117 } 
   117 } 
   118 else 
   118 else 
   119 {
   119 {
   120         message("Nothing to do!");
   120         message("Nothing to do!");