Location: PHPKode > projects > Helpdesk Over Web > how/sysmgmt/userdetail.php
<?php

// Purpose : Allow viewing and editing of user data.

// Include Configuration File
require_once ('../includes/config.inc'); 

// Set the page title and include the HTML header.
$page_title = 'Helpdesk Over Web - System User';
include ('../includes/header.html');

// Connect to Database
require_once ('../includes/mysql_connect.php');
	
echo ("<H1>System Users</H1>");
echo ("<H3>User Profile</H3>");
echo ("<P>Edit changes directly into fields. System Login is a read-only field and cannot be modified. Click Submit when done. A user can be removed by selecting the Delete option - note that user deletion occurs immediately and is irrecoverable!</P>");

$userid = $HTTP_GET_VARS['selecteduser'];
$sql = "SELECT `Tel`,`Email`,`FullName`,`Role` FROM `systemusers` WHERE (`systemusers`.`HOWLogin` = '$userid') ";
$records = range(1, 500);
$result = mysql_query($sql)
   or die("Invalid query: " . mysql_error());
list($tel, $email, $fullname, $role) = mysql_fetch_row($result);

// Start outputting HTML code for table.
echo "<TABLE WIDTH='450' PADDING='2' SPACING='2'><FORM METHOD='POST' ACTION='editrecord-process.php?selecteduser=$userid'>";
echo "<TR><TD ALIGN='RIGHT'><B>System Login:</B></TD><TD>&nbsp;&nbsp;$userid</TD></TR>";
echo "<TR><TD ALIGN='RIGHT'><B>Full Name:</B></TD><TD>&nbsp;&nbsp;<input type='text' name='fullname' value = '$fullname' size='40' class='textbox'></TD></TR>";
echo "<TR><TD ALIGN='RIGHT'><B>User Role:</B></TD><TD>&nbsp;&nbsp;<select name='role' value='$role' class='textbox'>";
		// If-Else Block to pre-select role value in drop-down box. Compares value of $role variable with
		// pre-determined text strings and outputs appropriate option statements.
		if ($role == 'Engineer') {
			echo '<option selected>Engineer<option>Senior Management<option>Helpdesk Manager</select></TD></TR>'; }
		else if ($role == 'Helpdesk Manager') {
			echo '<option>Engineer<option>Senior Management<option selected>Helpdesk Manager</select></TD></TR>'; }
		else if ($role == 'Senior Management') {
			echo '<option>Engineer<option selected>Senior Management<option>Helpdesk Manager</select></TD></TR>'; }
echo "<TR><TD ALIGN='RIGHT'><B>Telephone:</B></TD><TD>&nbsp;&nbsp;<input type='text' name='tel' value = '$tel' size='18' class='textbox'></TD></TR>";
echo "<TR><TD ALIGN='RIGHT'><B>Email:</B></TD><TD>&nbsp;&nbsp;<input type='text' name='email' value = '$email' size='40' class='textbox'></TD></TR>";
echo "<TR><TD COLSPAN='2' ALIGN='center'><BR><input type='submit' value='Submit'></TD></TR>";
echo "<TR><TD COLSPAN='2' ALIGN='center'><BR><H4><A HREF='deleteuser.php?selecteduser=$userid'>Delete User</A></TD></TR>";
echo "</TABLE></FORM>";
echo "<H4>[ <A HREF='sysusers.php'>User Administration Main Page</A> ]</H4>";
// Include standard HTML footer
include ('../includes/footer.html');
?>
Return current item: Helpdesk Over Web