delete_user.php
changeset 13 2ff220cfde13
parent 8 47dd15d8bb8c
child 47 ae140472d97c
equal deleted inserted replaced
12:7be4525290cc 13:2ff220cfde13
     1 <?php
     1 <?php
     2 
       
     3 // +--------------------------------------------------------------------+
       
     4 // | PowerAdmin								|
       
     5 // +--------------------------------------------------------------------+
       
     6 // | Copyright (c) 1997-2002 The PowerAdmin Team			|
       
     7 // +--------------------------------------------------------------------+
       
     8 // | This source file is subject to the license carried by the overal	|
       
     9 // | program PowerAdmin as found on http://poweradmin.sf.net		|
       
    10 // | The PowerAdmin program falls under the QPL License:		|
       
    11 // | http://www.trolltech.com/developer/licensing/qpl.html		|
       
    12 // +--------------------------------------------------------------------+
       
    13 // | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl>	|
       
    14 // |          Sjeemz <sjeemz <AT> sjeemz <DOT> nl>			|
       
    15 // +--------------------------------------------------------------------+
       
    16 
       
    17 //
       
    18 // $Id: delete_user.php,v 1.9 2003/01/01 22:33:46 azurazu Exp $
       
    19 //
       
    20 
       
    21 require_once("inc/toolkit.inc.php");
     2 require_once("inc/toolkit.inc.php");
    22 
     3 
    23 $id = ($_POST["id"]) ? $_POST["id"] : $_GET["id"];
     4 $id = ($_POST["id"]) ? $_POST["id"] : $_GET["id"];
    24 
     5 
    25 if(isset($id)) 
     6 if(isset($id)) 
    49 		
    30 		
    50                 delete_user($id);
    31                 delete_user($id);
    51                 clean_page($BASE_URL . $BASE_PATH . "users.php");
    32                 clean_page($BASE_URL . $BASE_PATH . "users.php");
    52         }
    33         }
    53         include_once("inc/header.inc.php");
    34         include_once("inc/header.inc.php");
    54         ?><H2><? echo _('Delete user'); ?> "<?= get_fullname_from_userid($id) ?>"</H2>
    35         ?>
    55         <FORM METHOD="post">
    36 	
       
    37     <h3><? echo _('Delete user'); ?> "<? echo get_fullname_from_userid($id) ?>"</h3>
       
    38      <form method="post">
    56         <?
    39         <?
    57         $domains = get_domains_from_userid($id);
    40         $domains = get_domains_from_userid($id);
    58         if (count($domains) > 0) 
    41         if (count($domains) > 0) 
    59         {
    42         {
    60         	echo _('This user has access to the following domain(s)'); ?> :<BR><?
    43         	echo _('This user has access to the following zone(s)'); ?> :<BR><?
    61                 $users = show_users($id);
    44                 $users = show_users($id);
    62                 if(count($users) < 1) 
    45                 if(count($users) < 1) 
    63                 {
    46                 {
    64                         $add = " CHECKED DISABLED";
    47                         $add = " CHECKED DISABLED";
    65                         $no_users = 1;
    48                         $no_users = 1;
    66                 }
    49                 }
    67                 ?>
    50                 ?>
    68                 <TABLE BORDER="0" CELLSPACING="4">
    51                 <table>
    69                 <TR STYLE="font-weight: Bold"><TD WIDTH="50" CLASS="tdbg">Delete</TD><TD CLASS="tdbg">Name</TD><? if (!$no_users) { ?><TD CLASS="tdbg">New owner</TD><? } ?></TR>
    52                  <tr>
       
    53 		  <td class="n">Delete</td>
       
    54 		  <td class="n">Name</td>
       
    55 		<? if (!$no_users) { ?>
       
    56 		  <td class="n">New owner</td>
       
    57 		<? } ?>
       
    58 		 </tr>
    70                 <?
    59                 <?
    71                 foreach ($domains as $d) 
    60                 foreach ($domains as $d) 
    72                 {
    61                 {
    73                         ?><TR><TD CLASS="tdbg" ALIGN="center"><?
    62                         ?>
       
    63                  <tr>
       
    64 		  <td class="n" align="center"><?
    74                         if ($no_users) 
    65                         if ($no_users) 
    75                      	{ 
    66                      	{ 
    76                      		?><INPUT TYPE="hidden" NAME="delete[]" VALUE="<?= $d["id"] ?>"><?
    67                      		?><input type="hidden" name="delete[]" value="<? echo $d["id"] ?>"><?
    77                         } 
    68                         } 
    78                         ?><INPUT TYPE="checkbox"<?= $add ?> NAME="delete[]" VALUE="<?= $d["id"] ?>"></TD><TD CLASS="tdbg"><?= $d["name"] ?></TD><TD CLASS="tdbg"><? 
    69                         ?><input type="checkbox"<? echo $add ?> name="delete[]" value="<? echo $d["id"] ?>"></td><td class="n"><? echo $d["name"] ?></td><td class="n"><? 
    79                         if (!$no_users) 
    70                         if (!$no_users) 
    80                         { 
    71                         { 
    81                         	?><SELECT NAME="domain[<?= $d["id"] ?>]"><?
    72                         	?><select name="domain[<? echo $d["id"] ?>]"><?
    82                         	foreach($users as $u) 
    73                         	foreach($users as $u) 
    83                         	{
    74                         	{
    84                         	        ?><OPTION VALUE="<?= $u["id"] ?>"><?= $u["fullname"] ?></OPTION><?
    75                         	        ?><option value="<? echo $u["id"] ?>"><? echo $u["fullname"] ?></option><?
    85                         	}
    76                         	}
    86                         	?></SELECT></TD><? 
    77                         	?></select></td><? 
    87                         } 
    78                         } 
    88                         ?></TR><?
    79                         ?></tr><?
    89                 }
    80                 }
    90                 ?></TABLE><?
    81                 ?></table><?
    91         }
    82         }
    92         
    83         
    93         $message = _('You are going to delete this user, are you sure?');
    84         $message = _('You are going to delete this user, are you sure?');
    94         if(($numrows = $db->queryOne("select count(id) from zones where owner=$id")) != 0)
    85         if(($numrows = $db->queryOne("select count(id) from zones where owner=$id")) != 0)
    95         {
    86         {
    96         	$message .= " " . _('This user has access to ') . $numrows . _('domain(s), by deleting him you will also delete these domains');
    87         	$message .= " " . _('This user has access to ') . $numrows . _(' zones, by deleting him you will also delete these zones.');
    97         }
    88         }
    98 
    89 
    99         ?>
    90         ?>
   100         <BR><FONT CLASS="warning"><?= $message ?></FONT><BR><BR>
    91         <font class="warning"><? echo $message ?></font><br>
   101         <INPUT TYPE="hidden" NAME="id" VALUE="<?=$id ?>">
    92         <input type="hidden" name="id" value="<? echo $id ?>">
   102         <INPUT TYPE="hidden" NAME="confirm" VALUE="1">
    93         <input type="hidden" name="confirm" value="1">
   103         <INPUT TYPE="submit" CLASS="button" VALUE="<? echo _('Yes'); ?>"> <INPUT TYPE="button" CLASS="button" OnClick="location.href='users.php'" VALUE="<? echo _('No'); ?>"></FORM>
    94         <input type="submit" class="button" value="<? echo _('Yes'); ?>"> <input type="button" class="button" OnClick="location.href='users.php'" value="<? echo _('No'); ?>"></FORM>
   104         <?
    95         <?
   105         include_once("inc/footer.inc.php");
    96         include_once("inc/footer.inc.php");
   106 } 
    97 } 
   107 else 
    98 else 
   108 {
    99 {