【php开源代码栏目提醒】:网学会员php开源代码为您提供blogAdminPost.php参考,解决您在blogAdminPost.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;
}
}
$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 blogmessages (ca_id, blog_date, blog_title, blog_message) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['select'], "int"),
GetSQLValueString($_POST['blog_date'], "date"),
GetSQLValueString($_POST['blog_title'], "text"),
GetSQLValueString($_POST['blog_message'], "text"));
mysql_select_db($database_connData, $connData);
$Result1 = mysql_query($insertSQL, $connData) or die(mysql_error());
$insertGoTo = "blogAdminMessage.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
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);
?><!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><?php echo $row_RecWebInfo['webName']; ?></title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="page">
<div id="header">
<div id="webInfo">
<div class="webName"><?php echo $row_RecWebInfo['webName']; ?> </div>
<div class="webDesc"><?php echo $row_RecWebInfo['webDesc']; ?> </div>
<div class="webNavigation"></div>
</div>
</div>
<div id="sidemenu">
<h2>管理信息 </h2>
<ul>
<li><a href="<?php echo $logoutAction ?>">注销管理</a></li>
<li><a href="adminWebInfo.php">编辑网站信息</a></li>
</ul>
<h2>管理文章</h2>
<ul>
<li><a href="blogAdminCategory.php">文章分类管理</a></li>
<li><a href="blogAdminMessage.php">管理文章及回复</a></li>
<li><a href="blogAdminPost.php">添加文章</a></li>
</ul>
</div>
<div id="content">
<h1><a href="#">管理文章</a></h1>
<div id="commentform">
<form action="<?php echo $editFormAction; ?>" method="POST" id="form1" name="form1">
<h2>添加文章</h2>
<table border="0" align="center" cellpadding="10" cellspacing="0" bgcolor="#F0F0F0">
<tr>
<th valign="baseline">分类</th>
<td valign="baseline"><select name="select" id="select">
<?php
do {
?>
<option value="<?php echo $row_RecCategory['ca_id']?>"><?php echo $row_RecCategory['ca_name']?></option>
<?php
} while ($row_RecCategory = mysql_fetch_assoc($RecCategory));
$rows = mysql_num_rows($RecCategory);
if($rows > 0) {
mysql_data_seek($RecCategory, 0);
$row_RecCategory = mysql_fetch_assoc($RecCategory);
}
?>
</select>
<input name="blog_date" type="hidden" id="blog_date" value="<?php echo date("Y-m-d H:i:s");?>" /></td>
</tr>
<tr>
<th valign="baseline">标题</th>
<td valign="baseline"> <label>
<input name="blog_title" typ
上一篇:
blogAdminMessage.php
下一篇:
基于JSP邮件收发系统论文