Location: PHPKode > projects > Helpdesk Solutions > helpdesk/scripts/admin/admin_deluser.php
<?
include($DOCUMENT_ROOT.'/helpdesk/include/database.php');
include($DOCUMENT_ROOT.'/helpdesk/include/new_user.php');


session_start();

if ($valid != "yes") {
	header("Location: /helpdesk/login.php");
	exit;
}

$head = "Remove a User?";
$bttm_menu = " &nbsp;&nbsp;<a class=bttm_menu href='/helpdesk/scripts/main_adminmenu.php'>Main Menu</a>&nbsp;&nbsp;|
				&nbsp;&nbsp;<a class=bttm_menu href='/helpdesk/scripts/admin/admin_viewuser.php'>View Users</a>&nbsp;&nbsp;|
				&nbsp;&nbsp;<a class=bttm_menu href='/helpdesk/scripts/admin/admin_adduser.php'>Add a User</a>&nbsp;&nbsp;|
				&nbsp;&nbsp;<a class=bttm_menu href='/helpdesk/scripts/admin/admin_moduserview.php'>Modify a User</a>&nbsp;&nbsp;|
				&nbsp;&nbsp;<a class=bttm_menu href='/helpdesk/scripts/admin/admin_remuser.php'>Remove a User</a>&nbsp;&nbsp;|
				&nbsp;&nbsp;<a class=bttm_menu href='/helpdesk/logout.php'>Log Out</a>&nbsp;&nbsp;|
";

if (!$submit) {
	$sql = "SELECT f_name, l_name, dept_id, build_id, username FROM help_users WHERE user_id = '$select_userid'";
	$result = mysql_query($sql,$conn) or die(mysql_errno().":2 ".mysql_error());
	while ($row = mysql_fetch_array($result)) {
		$f_name = $row['f_name'];
		$l_name = $row['l_name'];
		$dept_id = $row['dept_id'];
		$build_id = $row['build_id'];
		$username = $row['username'];

		$names = "$f_name $l_name";
	}


	$bottom = "
	<h3>Are you sure you wish to remove this user?</h3>

	<form method=get action='$phpself'>
	<table>
	<tr><td class=user width=180>Name:<td>$names
	<tr><td class=user>Username:<td>$username
	<tr><td class=other>Department:<td>$dept_id
	<tr><td class=other>Building:<td>$build_id
	</table>
	<br>
	<input type=hidden name=select_userid value='$select_userid'>
	<input type=hidden name=names value='$names'>
	<input type=submit name=submit value='Yes - Remove this User'>
	</form>
	";
}

if ($submit) {
	$sql = "DELETE FROM help_users WHERE user_id = '$select_userid'";
	$result = mysql_query($sql,$conn) or die(mysql_errno().":2 ".mysql_error());

	$bottom = "<h3>$names has been removed from the system";
}



include($DOCUMENT_ROOT.'/helpdesk/include/template.inc.php');
?>
Return current item: Helpdesk Solutions