【php开源代码栏目提醒】:网学会员在php开源代码频道为大家收集整理了blogSearch.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 = "%";
if (isset($_GET['Year'])) {
$colname_RecBlog = (get_magic_quotes_gpc()) ? $_GET['Year'] : addslashes($_GET['Year']);
}
$colname1_RecBlog = "%";
if (isset($_GET['Month'])) {
$colname1_RecBlog = (get_magic_quotes_gpc()) ? $_GET['Month'] : addslashes($_GET['Month']);
}
$colname2_RecBlog = "%";
if (isset($_GET['Day'])) {
$colname2_RecBlog = (get_magic_quotes_gpc()) ? $_GET['Day'] : addslashes($_GET['Day']);
}
mysql_select_db($database_connData, $connData);
$query_RecBlog = sprintf("SELECT * FROM blogmessages WHERE blog_date LIKE '%s-%s-%s%%' ORDER BY blog_date DESC", $colname_RecBlog, $colname1_RecBlog, $colname2_RecBlog);
$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 = my
sql_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_RecCalend