【php开源代码栏目提醒】:网学会员为广大网友收集整理了,blogMessage.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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO blogcomments (blog_id, co_date, co_subject, co_name, co_email, co_comment) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['blog_id'], "int"),
GetSQLValueString($_POST['co_date'], "date"),
GetSQLValueString($_POST['co_subject'], "text"),
GetSQLValueString($_POST['co_name'], "text"),
GetSQLValueString($_POST['co_email'], "text"),
GetSQLValueString($_POST['co_comment'], "text"));
mysql_select_db($database_connData, $connData);
$Result1 = mysql_query($insertSQL, $connData) or die(mysql_error());
$insertGoTo = "blogMessage.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$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);
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 = my
sql_query($query_RecNewComment, $connData) or die(mysql_error());
$row_RecNewComment = mysql_fetch_assoc($RecNewComment);
$totalRows_RecNewComment = mysql_num_rows($RecNewComment);
$colname_RecBlog = "-1";
if (isset($_GET['blog_id'])) {
$colname_RecBlog = (get_magic_quotes_gpc()) ? $_GET['blog_id'] : addslashes($_GET['blog_id']);
}
mysql_select_db($database_connData, $connData);
$query_RecBlog = sprintf("SELECT * FROM blogmessages WHERE blog_id = %s", GetSQLValueString($colname_RecBlog, "int"));
$RecBlog = mysql_query($query_RecBlog, $connData) or die(mysql_error());
$row_RecBlog = mysql_fetch_assoc($RecBlog);
$totalRows_RecBlog = mysql_num_rows($RecBlog);
$colname_RecComments = "-1";
if (isset($_GET['blog_id'])) {
$colname_RecComments = (get_magic_quotes_gpc()) ? $_GET['blog_id'] : addslashes($_GET['blog_id']);
}
mysql_select_db($database_connData, $connData);
$query_RecComments = sprintf("SELECT * FROM blogcomments WHERE blog_id = %s ORDER BY co_date DESC", GetSQLValueString($colname_RecComments, "int"));
$RecComments = mysql_query($query_RecComments, $connData) or die(mysql_error());
$row_RecComments = mysql_fetch_assoc($RecComments);
$totalRows_RecComments = mysql_num_rows($RecComments)