administration page
<?php
//initialize the session
session_start();
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
session_unregister('MM_Username');
session_unregister('MM_UserGroup');
$logoutGoTo = "index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php
$MM_authorizedUsers = "adminOnly";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "accessdenied.html";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>eightseven.net :: administration console</title>
<link rel="shortcut icon" href="http://www.eightseven.net/favicon.ico">
<meta name="MSSmartTagsPreventParsing" content="TRUE" />
<meta name="Description" content="British Rail Class 87 Locomotives, Photographs, Status, News and Class Happenings" />
<meta name="Abstract" content="British Rail Class 87 Locomotives, Photographs, Status, News and Class Happenings" />
<meta name="Robots" content="all" />
<meta name="Distribution" content="Global" />
<meta name="Revisit-After" content="5 days" />
<meta name="Rating" content="General" />
<link href="css/nav.css" rel="stylesheet" type="text/css" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="holder">
<a href="index.php"><img src="graphics/banner.png" alt="eightseven .net" border="0" title="British Rail Class 87 :: eightseven.net" /></a>
<div id="navcontainer"><ul>
<li><a href="index.php">home</a></li><li><a href="about.php">about</a></li><li><a href="news.php">news</a></li><li><a href="gallerytop.php">gallery</a></li><li><a href="links.php">links</a></li><li><a href="contact.php">contact</a></li><li><a href="#photo.html">photography</a></li>
</ul></div>
<div id="full_box">
<table border="0" cellpadding="1" cellspacing="0" bordercolor="#000000" bgcolor="#FFFFFF">
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<td width="69"> </td>
<td width="601">Submit File For Loco Data</td>
<td width="601"> </td>
</tr>
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<td> </td>
<td><form method="post" action="execsv.php" enctype="multipart/form-data" name="form1" id="form1">
<input type="file" name="inputfile2" enctype="multipart/form-data" />
<input name="Browse2" type="submit" id="Browse" value="Upload File" />
</form></td>
<td><a href="insertnews.php">Insert A News Item</a> </td>
</tr>
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<td height="30"> </td>
<td>Submit File For Gallery</td>
<td><a href="adminnews.php">UPDATE an News Item</a></td>
</tr>
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<td> </td>
<td><form method="post" action="Connections/importimages.php" enctype="multipart/form-data" name="form2" id="form2">
<input type="file" name="inputfile_img" enctype="multipart/form-data" />
<input name="Browse3" type="submit" id="Browse3" value="Upload File" />
</form></td>
<td><a href="editloco.php">Update a Locomotive Entry </a></td>
</tr>
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<td> </td>
<td>Submit File For Loco Allocations</td>
<td> </td>
</tr>
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<td> </td>
<td><form method="post" action="Connections/execsv-gen.php" enctype="multipart/form-data" name="form3" id="form3">
<input type="file" name="inputfile" enctype="multipart/form-data" />
<input name="Browse" type="submit" id="Browse4" value="Upload File" />
</form></td>
<td><a href="uploadgalleryimage.php">Upload Image for Gallery</a></td>
</tr>
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<td height="26"> </td>
<td>Duplicate / Back Up News Table</td>
<td><a href="failed.php">Show Failed Login Attempts</a></td>
</tr>
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<td> </td>
<td><form method="post" action="Connections/duplicate_news.php" name="form4" id="form4">
<input name="back_up" type="Submit" value="Back UP News" />
</form></td>
<td><a href="<?php echo $logoutAction ?>">Leave the Admin Pages</a> </td>
</tr>
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<td height="30"> </td>
<td> </td>
<td><a href="uploadgalleryimage.php">Insert an image into the gallery. </a></td>
</tr>
</table>
</div>
<div id="footer"><strong>© eightseven.net </strong></div>
</div>
</body>
</html>
that is the code. As you can see, I do use $_POST.