Location: PHPKode > projects > Helpdesk Over Web > how/users/userdetail.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 - User Database';
include ('../includes/header.html');

// Connect to Database
require_once ('../includes/mysql_connect.php');
echo ("<H1>Users Database</H1>");
echo ("<H3>User Profile</H3>");
echo ("<P>Edit changes directly into fields. Username 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 * FROM users WHERE (UserID = '$userid') ";
$records = range(1, 500);
$result = mysql_query($sql)
   or die("Invalid query: " . mysql_error());
list($userid, $UserFirstName, $UserSurname, $Dept, $Site, $Tel, $Email) = 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>First Name:</B></TD><TD>&nbsp;&nbsp;<input type='text' name='firstname' value = '$UserFirstName' size='40' class='textbox'></TD></TR>";
echo "<TR><TD ALIGN='RIGHT'><B>Surname:</B></TD><TD>&nbsp;&nbsp;<input type='text' name='surname' value = '$UserSurname' size='40' class='textbox'></TD></TR>";
	echo "<TR><TD ALIGN='RIGHT'><B>Dept:</B></TD><TD>&nbsp;&nbsp;<SELECT NAME='dept'>";
	$deptsql = "SELECT DeptName FROM depts ORDER BY DeptName;";
	$deptlist = mysql_query($deptsql)
	   or die("Invalid query: " . mysql_error());
	while($i = mysql_fetch_row($deptlist)) 
		if($i[0] == $Dept)
			echo "<OPTION SELECTED>$i[0]";
			echo "<OPTION >$i[0]</OPTION>";
	echo "</SELECT></TD></TR>";
	echo "<TR><TD ALIGN='RIGHT'><B>Site:</B></TD><TD>&nbsp;&nbsp;<SELECT NAME='site'>";
	$sitesql = "SELECT SiteName FROM sites ORDER BY SiteName;";
	$sitelist = mysql_query($sitesql)
	   or die("Invalid query: " . mysql_error());
	while($i = mysql_fetch_row($sitelist)) 
		if($i[0] == $Site)
			echo "<OPTION SELECTED>$i[0]";
			echo "<OPTION >$i[0]</OPTION>";
	echo "</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 "<INPUT TYPE=hidden NAME='userid' VALUE='$userid'>";
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='useradmin.php?sortorder=UserSurname'>User Administration Main Page</A> ]</H4>";
// Include standard HTML footer
include ('../includes/footer.html');
Return current item: Helpdesk Over Web