Location: PHPKode > projects > SiteX > admin/user_types.php
<?PHP
ob_start();
session_start();
include("../includes/globals.php.inc");
include("../includes/functions.php");
include("../lang/English.php");
if(strtolower($sxSetup['Language']) != 'english') include("../lang/".$sxSetup['Language'].".php");
include("../themes/$THEME_FOLDER/config.php.inc");
if((!userEditor())AND(!userAdmin()))  loginError($sxLang['LoginRequired']);
if((userEditor())AND(!$sxSetup['EditorRightsUserTypes']))  loginError($sxLang['LoginRequired']);

if($Submit)
{
	if(strlen($type_name) > 0)
	{
		$query = "INSERT INTO $DB_Users_Types (name) VALUES ('$type_name')";
		$result = mysql_query($query, $Link) or queryError("29", mysql_error());
		$message = $sxLang['MessageUserTypeAdded'];
	}
}

if($editFinal)
{
	$query = "UPDATE $DB_Users_Types SET name='$type_name' WHERE id='$editid'";
	$result = mysql_query($query, $Link) or queryError("30", mysql_error());
	$editid = "";
	$message = $sxLang['MessageUserTypeUpdated'];
}

if($delete)
{
	$query = "DELETE FROM $DB_Users_Types WHERE id='$delete'";
	$result = mysql_query($query, $Link) or queryError("31", mysql_error());
	$message = $sxLang['MessageUserTypeDeleted'];
}
$sxTitleAddendum = $sxLang['AdminHeading'];
include("../themes/$THEME_FOLDER/header.php");
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function confirmDelete(theID,theName){
	if(confirm("<?PHP echo $sxLang['GeneralJSDeleteEntry4']; ?> '"+theName+"' <?PHP echo $sxLang['GeneralJSDeleteEntry2']; ?>")){
		window.location='<?PHP print $PHP_SELF."?delete="; ?>'+theID;
	}
}
//-->
</script>     
<div class="bodyWrapper">
   <h1 class="sxAdminHeading"><?PHP echo $sxLang['UserHeadingTypes']; ?></h1>
   <div class="sxAdminBreadcrumbs"><?PHP if(userAdmin()) { ?><a href="index.php"><?PHP echo $sxLang['AdminBreadcrumb']; ?><?PHP }?><?PHP if(userEditor()) { ?><a href="editor_index.php"><?PHP echo $sxLang['EditorBreadcrumb']; ?><?PHP }?></a> > <a href="user_manager.php"><?PHP echo $sxLang['UserHeadingManager']; ?></a> > <?PHP echo $sxLang['UserHeadingTypes']; ?></div>
   <?PHP echoMessage($message); ?>
	<table border="0" cellspacing="2" cellpadding="5">
	  <tr>
		<td class="tableColumn"><?PHP echo $sxLang['GeneralItemID']; ?></td>
		<td class="tableColumn"><?PHP echo $sxLang['GeneralItemName']; ?></td>
		<td class="tableColumn"><?PHP echo $sxLang['GeneralItemOptions']; ?></td>
	  </tr>
	  <form name="sxFormUserTypes" action="<?PHP echo $PHP_SELF; ?>" method="post">
		<?PHP
		
		$query = "SELECT * FROM $DB_Users_Types ORDER BY id ASC";
		$result = mysql_query($query, $Link) or queryError("24", mysql_error());
		while($ROW = mysql_fetch_object($result))
		{
			echo '  <tr bgcolor="' . $sxTheme['ColorTableRow'] . '">';
			
			if($editid == $ROW->id)
			{
				echo '	   <td></td>';
				echo '     <td colspan="2"><input name="type_name" type="text" maxlength="255" style="width:200px;" value="' . htmlspecialchars($ROW->name) . '" /> ';
				echo '     <input type="hidden" name="editid" value="' . $editid . '" />';
				echo '     <input style="width:70px;" name="editFinal" type="submit" value="' . $sxLang['ButtonEdit'] . '" class="sxButton" /></td>';
			}
			else
			{
				if(($editid)OR($ROW->id == 1)OR($ROW->id == 2)OR($ROW->id == 3)OR($ROW->id == 4)OR($ROW->id == 5))
				{			
					echo '	   <td>' . $ROW->id . '</td>';
					echo '     <td>' . $ROW->name . '</td>';
					echo '     <td>' . $sxLang['UserTypeLocked'] . '</td>';
				}
				else
				{			
					echo '	   <td>' . $ROW->id . '</td>';
					echo '     <td>' . $ROW->name . '</td>';
					echo '     <td><a href="' . $PHP_SELF . '?editid=' . $ROW->id . '" title="' . $sxLang['ButtonEdit'] . '"><img src="../images/admin_edit.gif" style="border: 0;" alt="' . $sxLang['ButtonEdit'] . '" /></a> ';
					echo '         <a href="#" onclick="confirmDelete(' . $ROW->id . ',\'' . htmlspecialchars(addslashes($ROW->name)) . '\')" title="' . $sxLang['ButtonDelete'] . '"><img src="../images/admin_delete.gif" style="border: 0;" alt="' . $sxLang['ButtonDelete'] . '" /></a></td>';
				}
			}
			echo '  </tr>';
		}
		if(mysql_num_rows($result) == 0)
			echo '<tr bgcolor="' . $sxTheme['ColorTableRow'] . '"><td colspan="2"><em>No users types defined at this time.</em></td></tr>';
	
		?></form></table><p>
		<form name="form1" action="<?PHP echo $PHP_SELF; ?>" method="post">
		<input name="type_name" type="text" maxlength="255" style="width:200px;" /> 
		<input name="Submit" type="submit" value="<?PHP echo $sxLang['ButtonAdd']; ?>" style="width:100px;" class="sxButton" /></p>
		</form>
  </div>
<?PHP
include("../themes/$THEME_FOLDER/footer.php");
ob_end_flush();
?>
Return current item: SiteX