【php开源代码栏目提醒】:网学会员--在 php开源代码编辑为广大网友搜集整理了:blogCategory.php绩等信息,祝愿广大网友取得需要的信息,参考学习。
<?php require_once('Connections/connData.php'); ?>
<?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_RecBlog = 5;
$pageNum_RecBlog = 0;
if (isset($_GET['pageNum_RecBlog'])) {
$pageNum_RecBlog = $_GET['pageNum_RecBlog'];
}
$startRow_RecBlog = $pageNum_RecBlog * $maxRows_RecBlog;
$colname_RecBlog = "-1";
if (isset($_GET['ca_id'])) {
$colname_RecBlog = (get_magic_quotes_gpc()) ? $_GET['ca_id'] : addslashes($_GET['ca_id']);
}
mysql_select_db($database_connData, $connData);
$query_RecBlog = sprintf("SELECT * FROM blogmessages WHERE ca_id = %s ORDER BY blog_date DESC", GetSQLValueString($colname_RecBlog, "int"));
$query_limit_RecBlog = sprintf("%s LIMIT %d, %d", $query_RecBlog, $startRow_RecBlog, $maxRows_RecBlog);
$RecBlog = mysql_query($query_limit_RecBlog, $connData) or die(mysql_error());
$row_RecBlog = mysql_fetch_assoc($RecBlog);
if (isset($_GET['totalRows_RecBlog'])) {
$totalRows_RecBlog = $_GET['totalRows_RecBlog'];
} else {
$all_RecBlog = mysql_query($query_RecBlog);
$totalRows_RecBlog = mysql_num_rows($all_RecBlog);
}
$totalPages_RecBlog = ceil($totalRows_RecBlog/$maxRows_RecBlog)-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);
mysql_select_db($database_connData, $connData);
$query_RecNewPost = "SELECT * FROM blogmessages ORDER BY blog_date DESC LIMIT 5";
$RecNewPost = mysql_query($query_RecNewPost, $connData) or die(mysql_error());
$row_RecNewPost = mysql_fetch_assoc($RecNewPost);
$totalRows_RecNewPost = mysql_num_rows($RecNewPost);
mysql_select_db($database_connData, $connData);
$query_RecNewComment = "SELECT * FROM blogcomments ORDER BY co_date DESC LIMIT 5";
$RecNewComment = mysql_query($query_RecNewComment, $connData) or die(mysql_error());
$row_RecNewComment = mysql_fetch_assoc($RecNewComment);
$totalRows_RecNewComment = mysql_num_rows($RecNewComment);
$theYear_RecCalendar = date("Y");
if (isset($_GET["Year"])) {
$theYear_RecCalendar = (get_magic_quotes_gpc()) ? $_GET["Year"] : addslashes($_GET["Year"]);
}
$theMonth_RecCalendar = date("m");
if (isset($_GET["Month"])) {
$theMonth_RecCalendar = (get_magic_quotes_gpc()) ? $_GET["Month"] : addslashes($_GET["Month"]);
}
mysql_select_db($database_connData, $connData);
$query_RecCalendar = sprintf("SELECT * FROM blogmessages WHERE blog_date LIKE '%s-%s%%' ORDER BY blog_date ASC", $theYear_RecCalendar,$theMonth_RecCalendar);
$RecCalendar = mysql_query($query_RecCalendar, $connData) or die(mysql_error());
$row_RecCalendar = mysql_fetch_assoc($RecCalendar);
$totalRows_RecCalendar = mysql_num_rows($RecCalendar);
$timestamp = mktime(0, 0, 0, $theMonth_RecCalendar, 1, $theYear_RecCalendar);
//计算该月的第一天为星期几,整个月有几天
$first_wday = date("w", $timestamp);
$day_of_month = date("t", $timestamp);
//上个月下个月
$prev_mon = ($theMonth_RecCalendar == 1) ? 12 : $theMonth_RecCalendar-1;
$next_mon = ($theMonth_RecCalendar == 12) ? 1 : $theMonth_RecCalendar+1;
$prev_mon = ($prev_mon < 10) ? "0".strval($prev_mon) : strval($prev_mon);
$prev_year = ($theMonth_RecCalendar == 1) ? $theYear_RecCalendar-1 : $theYear_RecCalendar;
$next_mon = ($next_mon < 10) ? "0".strval($next_mon) : strval($next_mon);
$next_year = ($theMonth_RecCalendar == 12) ? $theYear_RecCalendar+1 : $theYear_RecCalendar;
do {
$dayNum = substr($row_RecCalendar['blog_date'],8,2);
if(!isset($aday[$dayNum])){
$aday[$dayNum] = 1;
}else{
$aday[$dayNum]++;
}
} while ($row_RecCalendar = mysql_fetch_assoc($RecCalendar));
mysql_free_result($RecCalendar);
$queryString_RecBlog = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_RecBlog") == false &&
stristr($param, "totalRows_RecBlog") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_RecBlog = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_RecBlog = sprintf("&totalRows_RecBlog=%d%s", $totalRows_RecBlog, $queryString_RecBlog);
$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);
}
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
$MM_keepBoth = $MM_keepURL
上一篇:
blogAdminPost.php
下一篇:
浮生若萍