Location: PHPKode > projects > NetLink > netlink_os/NIMDA_778.php
With the <b>Admin</b> mode, you can add, modify, and delete user accounts. Use the table below to view user accounts.
<br/><br/>

	<fieldset><legend>Accounts</legend>Create, Delete, or modify a user's account<br/>
	<?php
	extract($_GET);
	switch ($order)
	{
	case "ud":
		$sql="SELECT * FROM Accounts ORDER BY Username DESC";
		$text="Username DESC";
		break;
	case "o":
		$sql="SELECT * FROM Accounts ORDER BY FirstName";
		$text="Owner";
		break;
	case "od":
		$sql="SELECT * FROM Accounts ORDER BY FirstName DESC";
		$text="Owner DESC";
		break;
	case "p":
		$sql="SELECT * FROM Accounts ORDER BY email ";
		$text="Password";
		break;
	case "pd":
		$sql="SELECT * FROM Accounts ORDER BY email  DESC";
		$text="Password DESC";
		break;
	case "e":
    $sql="SELECT * FROM Accounts ORDER BY edit";
    $text="Editing Type";
    break;
  case "ed":
    $sql="SELECT * FROM Accounts ORDER BY edit DESC";
    $text="Editing Type DESC";
    break;
  case "t":
    $sql="SELECT * FROM Accounts ORDER BY theme";
    $text="Theme";
    break;
  case "td":
    $sql="SELECT * FROM Accounts ORDER BY theme DESC";
    $text="Theme DESC";
    break;
  case "l":
    $sql="SELECT * FROM Accounts ORDER BY last";
    $text="Last Login";
    break;
  case "ld":
    $sql="SELECT * FROM Accounts ORDER BY last DESC";
    $text="Last Login DESC";
    break;
  case "i":
    $sql="SELECT * FROM Accounts ORDER BY ip";
    $text="IP Addres";
    break;
  case "id":
    $sql="SELECT * FROM Accounts ORDER BY ip DESC";
    $text="IP Address DESC";
    break;
	default :
		$sql="SELECT * FROM Accounts ORDER BY Username";
		$text="Default: Username";
		break;
	}
	
	echo "Ordering Style: <b>$text</b><br/><br/>";
	?>
	<div align='center' width='75%'> <!--For aligning purposes-->
	<div style='border:2px black solid; width: 700; margin: auto;'>
	<table summary='cms' border='0' class='cms'>
	<tr>
	<td align='center' class='cms_title' colspan='8'>
	Accounts <!--TABLE TITLE-->
	</td>
	</tr><tr>
	<th>
	<a href='?id=welcome'>
	<img src='Images/order_up.gif' alt='' border='0'/>
	</a>
	&nbsp;Account&nbsp;
	<a href='?id=welcome&order=ud'>
	<img src='Images/order_down.gif' alt='' border='0'/>
	</a>
	</th>
	
	<th>
	<a href='?id=welcome&order=o'>
	<img src='Images/order_up.gif' alt='' border='0'/>
	</a>
	&nbsp;Owner&nbsp;
	<a href='?id=welcome&order=od'>
	<img src='Images/order_down.gif' alt='' border='0'/>
	</a>
	</th>
	
	<th>
	<a href='?id=welcome&order=p'>
	<img src='Images/order_up.gif' alt='' border='0'/>
	</a>
	&nbsp;E-mail&nbsp;
	<a href='?id=welcome&order=pd'>
	<img src='Images/order_down.gif' alt='' border='0'/>
	</a>
	</th>
	
	<th>
		<a href='?id=welcome&order=e'>
	<img src='Images/order_up.gif' alt='' border='0'/>
	</a>
	&nbsp;Edit Type&nbsp;
	<a href='?id=welcome&order=ed'>
	<img src='Images/order_down.gif' alt='' border='0'/>	
	</th>
	<th>
		<a href='?id=welcome&order=t'>
	<img src='Images/order_up.gif' alt='' border='0'/>
	</a>
	&nbsp;Theme&nbsp;
	<a href='?id=welcome&order=td'>
	<img src='Images/order_down.gif' alt='' border='0'/>	
		</th>
	<th style='width: 100px;'>
		<a href='?id=welcome&order=l'>
	<img src='Images/order_up.gif' alt='' border='0'/>
	</a>
	&nbsp;Last Login&nbsp;
	<a href='?id=welcome&order=ld'>
	<img src='Images/order_down.gif' alt='' border='0'/>	
		</th>
	<th>
		<a href='?id=welcome&order=i'>
	<img src='Images/order_up.gif' alt='' border='0'/>
	</a>
	&nbsp;Last IP&nbsp;
	<a href='?id=welcome&order=id'>
	<img src='Images/order_down.gif' alt='' border='0'/>	
		</th>
				
	<th>Delete</th>
	</td></tr>
<?php
	//DIRECTORY ROOT 
	$tr="#c0c0c0";

	//$size=File_Size($file);
	//open database and get password
	#Connct to database to retrive username #####################
	include("db.php");
	$dbh=mysql_connect ($host,$account,$acc_pw) or die (mysql_error());
	mysql_select_db ($table); 
	
	
			
	$rs=mysql_query($sql,$dbh);
	while ($row=mysql_fetch_array($rs))
	{
	$f_name=$row['FirstName'];
	$l_name=$row['LastName'];
	$user=$row['Username'];
	$email =$row['email'];
	$edit=$row['edit'];
	$theme=$row['theme'];
	$last=$row['last'];
	$ip=$row['ip'];
	
	echo "<tr bgcolor='$tr'>";
	echo "<td><a href='main.php?id=cmsu&user=$user'>$user</a></td>";
	echo "<td>$f_name $l_name</td>";
	echo "<td>";
	if ($email=="N/A")
    echo $email;
  else
    echo "<a href='mailto:$email'>".$email."</a>" ;
	echo "</td>\n<td>$edit</td>";
	echo "<td>$theme</td>";
	echo "<td>$last</td>";
	echo "<td>$ip</td>";
	
	echo "<td><a href='?id=delete_account&act=$user'>Delete</a></td>";
	echo "</tr>";
	
	if ($tr=="#c0c0c0")
		$tr="#ffffff";
	else
		$tr="#c0c0c0";
	}
	mysql_close($dbh);
?>
</table></div>
<!--ADD Account======================-->
<div class='add'><a href='?id=add_account'>Add an Account</a> | <a href='?id=upload'>Upload File</a> | <a href='?id=add_page'>Add Page</a></div>
</fieldset>
Return current item: NetLink