Location: PHPKode > projects > PHP MySQL Address Book > addressbook/usrmanagmnt.php
<?php
require("sesionchk.php");
if ($_SESSION['usr_level']!=1)
{
header('Location: index.php');
if (isset($_SESSION['db_is_logged_in'])) {
	unset($_SESSION['db_is_logged_in']);
}

exit;

}
?>
<html>
<head>
<title>
<?php
require("title.php");
?>
</title>
<!--<link rel="stylesheet" type="text/css" href="styles/wide_screen.css">-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body>
<?php

require("links.php");
include 'library/config.php';
include 'library/opendb.php';
/*
// how many rows to show per page
$rowsPerPage = 20;

// by default we show first page
$pageNum = 1;

// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
	$pageNum = $_GET['page'];
}

// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
*/
//$query  = "SELECT FirstName,EmailAddress,ID FROM contacts LIMIT $offset, $rowsPerPage";

//$query  = "SELECT FirstName,EmailAddress,ID FROM contacts ORDER BY FirstName  ASC";
$query  = "SELECT `user`,`usr_level`,`addedon`,`ID` FROM cal_accounts where usr_level<>1 ORDER BY user  ASC";
mysql_query("SET NAMES 'utf8'");
mysql_query('SET CHARACTER SET utf8'); 
$result = mysql_query($query) or die('Error, query failed');
?>


<!--<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
    <td style=" vertical-align: top;">
	</td>
    <td>-->
	<?php
	
echo "<table width=520 border='1' cellpadding='1' cellspacing='1' bordercolor='#000000'> <COLGROUP span='10' width='0*'>";
echo "<tr><td colspan='3'><h2>Add/Remove Users</h2></td><td colspan='2'><a href='addedituser.php?ID=-1'>Add New User</a></td><tr>";
?>
<tr bgcolor="#999999">
<td>&nbsp;

</td>
<td>
<b>
User Name
</td>
<td>
User Level</td>
<td>
Added On
</b>
</td>
<td>&nbsp;

</td>
</tr>
<?php
//echo "</td></tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
	echo "<td>";
	echo "<a href=\"addedituser.php?ID=".$row['ID']."&mod=e\">Edit</a>";
	echo "</td>";
	echo "<td>";
	if (trim($row['user'])!=="")
	{
	echo "<b>".$row['user']."</b>";
	}
	echo "</td>";
	
	echo "<td>";
	if (trim($row['usr_level'])!=="")
	{
	if (trim($row['usr_level'])=="2")
	{
	$usrlvl="Super User";
	}
	else if (trim($row['usr_level'])=="3")
	{
	$usrlvl="Normal User";
	}
	else
	{
	$usrlvl="Not Specified";
	}
	echo "<b>".$usrlvl."</b>";
	}
	echo "</td>";
	//echo "</td>";
	echo "<td>";
	if (trim($row['addedon'])!=="")
	{
	echo $row['addedon'];
	}
	echo "</td>";
	echo "<td>";
	echo "<a href=\"addedituser.php?ID=".$row['ID']."&mod=d\">Delete</a>";
//	echo "<a href=\"wabraaddressbook.php?ID=".$row['ID']."&salph=".$_GET[value]."&mod=del\">Delete</a>";
	
	echo "</td>";
	
	echo "</tr>";
/*


	echo $row['FirstName'] ." <a href=\"wabraaddressbook.php?ID=".$row['ID']."\">Edit</a> &nbsp; <a href=\"library/delrec.php?ID=".$row['ID']."&salph=".$_GET[value]."\">Delete</a> <br>";
	*/
}
echo '</table>';
include 'library/closedb.php';
?>
	<!--</td>
  </tr>
</table>-->
</body>
</html>
Return current item: PHP MySQL Address Book