2008-03-09 22:49:53 +00:00
< ? php
2011-03-28 10:48:43 +00:00
echo ( '<div style="margin: 10px;">' );
2008-03-09 22:49:53 +00:00
2011-03-28 10:48:43 +00:00
if ( $_SESSION [ 'userlevel' ] < '10' ) { include ( " includes/error-no-perm.inc.php " ); } else
2010-03-06 01:10:05 +00:00
{
2008-03-09 22:49:53 +00:00
echo ( " <h3>Delete User</h3> " );
2010-03-06 01:10:05 +00:00
if ( auth_usermanagement ())
{
2011-03-17 00:09:20 +00:00
if ( $_GET [ 'action' ] == " del " )
2010-03-06 01:10:05 +00:00
{
$delete_username = mysql_result ( mysql_query ( " SELECT username FROM users WHERE user_id = ' " . mres ( $_GET [ 'user_id' ]) . " ' " ), 0 );
2008-03-09 22:49:53 +00:00
2011-03-17 00:09:20 +00:00
if ( $_GET [ 'confirm' ] == " yes " )
2010-03-06 01:10:05 +00:00
{
mysql_query ( " DELETE FROM `devices_perms` WHERE `user_id` = ' " . mres ( $_GET [ 'user_id' ]) . " ' " );
2011-03-28 10:48:43 +00:00
if ( deluser ( $_GET [ 'user_id' ])) { echo ( " <span class=info>User ' $delete_username ' deleted!</span> " ); }
2011-03-17 00:09:20 +00:00
}
else
2010-03-06 01:10:05 +00:00
{
echo ( " <span class=alert>You have requested deletion of the user ' $delete_username '. This action can not be reversed.<br /><a href='?page=deluser&action=del&user_id= " . $_GET [ 'user_id' ] . " &confirm=yes'>Click to confirm</a></span> " );
}
2008-03-09 22:49:53 +00:00
}
2010-03-06 01:10:05 +00:00
# FIXME v mysql query should be replaced by authmodule
$userlist = mysql_query ( " SELECT * FROM `users` " );
2011-03-17 00:09:20 +00:00
while ( $userentry = mysql_fetch_array ( $userlist ))
2010-03-06 01:10:05 +00:00
{
$i ++ ;
echo ( $i . " . " . $userentry [ 'username' ] . "
2008-03-09 22:49:53 +00:00
< a href = '?page=deluser&action=del&user_id=" . $userentry[' user_id '] . "' >< img src = 'images/16/cross.png' align = absmiddle border = 0 ></ a >< br /> " );
2010-03-06 01:10:05 +00:00
}
}
else
{
2011-03-28 10:48:43 +00:00
print_error ( " Authentication module does not allow user management! " );
2008-03-09 22:49:53 +00:00
}
}
echo ( " </div> " );
?>