PHP论坛管理系统

2022-10-11 21:19:15 177 0
魁首哥

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 = “admin_login.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($_SERVER[‘QUERY_STRING’]) && strlen($_SERVER[‘QUERY_STRING’]) > 0)

$MM_referrer .= “?” . $_SERVER[‘QUERY_STRING’];

$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . “accesscheck=” . urlencode($MM_referrer);

header(“Location: “. $MM_restrictGoTo);

exit;

}

?>

$keyword=$_POST[keyword]; //定义keyword为表单中”keyword”的请求变量

if (!function_exists(“GetSQLValueString”)) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = “”, $theNo td efinedValue = “”)

{

if (PHP_VERSION < 6) {

$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”];

$maxRows_rs_bbs = 20;

$pageNum_rs_bbs = 0;

if (isset($_GET[‘pageNum_rs_bbs’])) {

$pageNum_rs_bbs = $_GET[‘pageNum_rs_bbs’];

}

$startRow_rs_bbs = $pageNum_rs_bbs * $maxRows_rs_bbs;

mysql_select_db($database_bbs, $bbs);

$query_rs_bbs = “SELECT bbs_Main.bbs_ID, bbs_Main.bbs_Time,bbs_Main.bbs_Hits, bbs_Main.bbs_Title,bbs_Main.bbs_url, bbs_Main.bbs_email,bbs_Main.bbs_sex, bbs_Main.bbs_Face,bbs_Main.bbs_Content, bbs_Main.bbs_Name,COUNT(bbs_Ref.bbs_Main_ID) AS ReturnNum, MAX(bbs_Ref.bbs_ref_Time) AS LatesTime FROM bbs_Main LEFT OUTER JOIN bbs_Ref ON bbs_Main.bbs_ID=bbs_Ref.bbs_Main_ID where bbs_Title like ‘%”.$keyword.”%’ GROUP BY bbs_Main.bbs_ID “;

$query_limit_rs_bbs = sprintf(“%s LIMIT %d, %d”, $query_rs_bbs, $startRow_rs_bbs, $maxRows_rs_bbs);

$rs_bbs = mysql_query($query_limit_rs_bbs, $bbs) or die(mysql_error());

$row_rs_bbs = mysql_fetch_assoc($rs_bbs);

if (isset($_GET[‘totalRows_rs_bbs’])) {

$totalRows_rs_bbs = $_GET[‘totalRows_rs_bbs’];

} else {

$all_rs_bbs = mysql_query($query_rs_bbs);

$totalRows_rs_bbs = mysql_num_rows($all_rs_bbs);

}

$totalPages_rs_bbs = ceil($totalRows_rs_bbs/$maxRows_rs_bbs)-1;

$queryString_rs_bbs = “”;

if (!empty($_SERVER[‘QUERY_STRING’])) {

$params = explode(“&”, $_SERVER[‘QUERY_STRING’]);

$newParams = array();

foreach ($params as $param) {

if (stristr($param, “pageNum_rs_bbs”) == false &&

stristr($param, “totalRows_rs_bbs”) == false) {

array_push($newParams, $param);

}

}

if (count($newParams) != 0) {

$queryString_rs_bbs = “&” . htmlentities(implode(“&”, $newParams));

}

}

$queryString_rs_bbs = sprintf(“&totalRows_rs_bbs=%d%s”, $totalRows_rs_bbs, $queryString_rs_bbs);

?>

论坛之家

border =”0″ align=”center” cellpadding=”0″ cellspacing=”0″>

查询主题:

0) { // Show if not first page ?>

”>第一页

0) { // Show if not first page ?>

”>前一页

”>下一个

”>最后一页

 

0) { // Show if recordset not empty ?>

心情 发言主题 作 者 回复 最新回复 阅读 发布时间 修改 删除
” alt=”” name=””> ”> ”> ”>
                                           目前没有发表任何主题
                    Copyright @ 2011 www.hbculture.com Inc.All rights reserved. 论坛之家

mysql_free_result($rs_bbs);

?>

收藏
分享
海报
0 条评论
177
上一篇:PHP处理字符中的emoji表情「判断/移除/存储」 下一篇:PHP为什么要对SESSION进行上锁的操作,你知道原因吗?

本站已关闭游客评论,请登录或者注册后再评论吧~

忘记密码?

图形验证码