View Membership Data
The view-membership-data.php script lets administrators view all their data in the membership table, which includes their member ID, user name, administrator password, users password, email, IP, and date. Changing data in tables is done in other scripts. The edit-meanings.php script allows them to see and edit their meanings table with the 100 editable status code meanings, and the edit-group-member.php script lets them see and edit their members' First Names. Their psb table, with ID, Status, Comment, and First Name, can be viewed with the psb.php script (which is their PSB™), where users may edit statuses and comments.
In viewing the administrator's member data in the host's members table, the configure.php file is included to establish server and database connections. Next, we get the username POSTed to our PHP script, with the username being POSTed from the page that sent us here. Note that if the Administrator is not logged in and therefore his username (stored in $U) is unset, he is sent to the login page.
Once the administrator's user name is found in the members table with this PHP script, his member data is displayed onscreen using the associative array method of $row['email'] for email, $row['id'] for ID, etc. Once the viewing is done, there's a button to let the administrator return to the Administrators Page. Note that JSON is used to pass the user name from PHP to JavaScript and then it gets POSTed back to the Administrator page. This keeps the user logged in so he need not login constantly as he uses various editing scripts.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<TITLE>View Membership Data</TITLE>
<meta name="description" content="View Membership Data">
<meta name="keywords" content="View Membership Data,view member record,php,javascript, dhtml, DHTML">
<style type="text/css">
BODY {margin-left:0; margin-right:0; margin-top:0;text-align:left}
p, li {font:16px Verdana; color:black;text-align:left}
td {font:16px Verdana; color:black;text-align:left;background-color:#ddd;}
table {margin:-50px 150px 50px 150px;}
h1 {font:bold 28px Verdana; color:black;text-align:center}
h2 {font:bold 24px Verdana;text-align:center}
h3 {font:bold 15px Verdana;}
</style>
</head><body>
<h1>View Membership Data</h1>
<div style="position:absolute;top:150px;left:200px;width:600px;background-color:#8aa;border:4px solid #00f">
<?php
include_once"configure.php";
$U=$_POST['username'];
if (!isset($U)) {
echo '<script language="javascript">alert("Please login.");
window.location="login.php"; </script>';
}
$result = mysql_query("SELECT * FROM members WHERE username = '$U'") or die(mysql_error());
$row = mysql_fetch_array($result);
echo "<table border='2' align='center>";
echo "<tr><th>".$row['username']."'s Membership</th></tr>";
echo "<tr><td>ID: ".$row['id']."</td></tr><br>";
echo "<tr><td>User Name: ".$row['username']."</td></tr><br>";
echo "<tr><td>Administrator Password: ".$row['admin_password']."</td></tr><br>";
echo "<tr><td>Users Password: ".$row['users_password']."</td></tr><br>";
echo "<tr><td>Email Address: ".$row['email']."</td></tr><br>";
echo "<tr><td>IP: ".$row['ip']."</td></tr><br>";
echo "<tr><td>Date: ".$row['date']."</td></tr><br>";
echo "</table>";
mysql_close();
?>
<br><br>
<form style='margin:0 0 40px 165px' name="MyForm" method="POST" action="administrator-page.php">
<input type="button" value="Return to Administrator Page" onclick="goback()">
<input type="hidden" name="username" value=" ">
</form>
</div>
<script language="javascript">
function goback(){
var u = <?php echo json_encode($U); ?>;
document.MyForm.username.value=u;
document.MyForm.submit();}
</script>
</body></html>