【php开源代码栏目提醒】:网学会员,鉴于大家对php开源代码十分关注,论文会员在此为大家搜集整理了“blogAdminMessage.php”一文,供大家参考学习!
<?php require_once('Connections/connData.php'); ?>
<?php
//initialize the session
if (!isset($_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['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "adminLogin.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$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 = "adminLogin.php";
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;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$currentPage = $_SERVER["PHP_SELF"];
mysql_select_db($database_connData, $connData);
$query_RecWebInfo = "SELECT * FROM webconfiguration";
$RecWebInfo = mysql_query($query_RecWebInfo, $connData) or die(mysql_error());
$row_RecWebInfo = mysql_fetch_assoc($RecWebInfo);
$totalRows_RecWebInfo = mysql_num_rows($RecWebInfo);
$maxRows_RecMessage = 10;
$pageNum_RecMessage = 0;
if (isset($_GET['pageNum_RecMessage'])) {
$pageNum_RecMessage = $_GET['pageNum_RecMessage'];
}
$startRow_RecMessage = $pageNum_RecMessage * $maxRows_RecMessage;
$colname_RecMessage = "%";
if (isset($_GET['ca_id'])) {
$colname_RecMessage = (get_magic_quotes_gpc()) ? $_GET['ca_id'] : addslashes($_GET['ca_id']);
}
mysql_select_db($database_connData, $connData);
$query_RecMessage = sprintf("SELECT * FROM blogmessages WHERE ca_id LIKE %s ORDER BY blog_date DESC", GetSQLValueString($colname_RecMessage, "text"));
$query_limit_RecMessage = sprintf("%s LIMIT %d, %d", $query_RecMessage, $startRow_RecMessage, $maxRows_RecMessage);
$RecMessage = mysql_query($query_limit_RecMessage, $connData) or die(mysql_error());
$row_RecMessage = mysql_fetch_assoc($RecMessage);
if (isset($_GET['totalRows_RecMessage'])) {
$totalRows_RecMessage = $_GET['totalRows_RecMessage'];
} else {
$all_RecMessage = mysql_query($query_RecMessage);
$totalRows_RecMessage = mysql_num_rows($all_RecMessage);
}
$totalPages_RecMessage = ceil($totalRows_RecMessage/$maxRows_RecMessage)-1;
mysql_select_db($database_connData, $connData);
$query_RecCategory = "SELECT * FROM blogcategory";
$RecCategory = mysql_query($query_RecCategory, $connData) or die(mysql_error());
$row_RecCategory = mysql_fetch_assoc($RecCategory);
$totalRows_RecCategory = mysql_num_rows($RecCategory);
$queryString_RecMessage = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_RecMessage") == false &&
stristr($param, "totalRows_RecMessage") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_RecMessage = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_RecMessage = sprintf("&totalRows_RecMessage=%d%s", $totalRows_RecMessage, $queryString_RecMessage);
$MM_paramName = "";
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
// create the list of parameters which should not be maintained
$MM_removeList = "&index=";
if ($MM_paramName != "") $MM_removeList .= "&".strtolower($MM_paramName)."=";
$MM_keepURL="";
$MM_keepForm="";
$MM_keepBoth="";
$MM_keepNone="";
// add the URL parameters to the MM_keepURL string
reset ($HTTP_GET_VARS);
while (list ($key, $val) = each ($HTTP_GET_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepURL .= "&".$key."=".urlencode($val);
}
}
// add the Form parameters to the MM_keepURL string
if(isset($HTTP_POST_VARS)){
reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepForm .= "&".$key."=".urlencode($val);
}
}
}
// c
上一篇:
blogAdminFix.php
下一篇:
天亮之后