【php开源代码栏目提醒】:网学会员为需要php开源代码的朋友们搜集整理了voteAdmin.php相关资料,希望对各位网友有所帮助!
<?php require_once('Connections/connVoteSystem.php'); ?>
<?php
// *** Restrict Access To Page: Grant or deny access to this page
$FF_authorizedUsers=" ";
$FF_authFailedURL="voteAdminLogin.php";
$FF_grantAccess=0;
session_start();
if (isset($_SESSION["MM_Username"])) {
if (true || !(isset($_SESSION["MM_UserAuthorization"])) || $_SESSION["MM_UserAuthorization"]=="" || strpos($FF_authorizedUsers, $_SESSION["MM_UserAuthorization"])) {
$FF_grantAccess = 1;
}
}
if (!$FF_grantAccess) {
$FF_qsChar = "?";
if (strpos($FF_authFailedURL, "?")) $FF_qsChar = "&";
$FF_referrer = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) $FF_referrer .= "?" . $_SERVER['QUERY_STRING'];
$FF_authFailedURL = $FF_authFailedURL . $FF_qsChar . "accessdenied=" . urlencode($FF_referrer);
header("Location: $FF_authFailedURL");
exit;
}
$currentPage = $_SERVER["
PHP_SELF"];
$maxRows_RecVoteMain = 10;
$pageNum_RecVoteMain = 0;
if (isset($_GET['pageNum_RecVoteMain'])) {
$pageNum_RecVoteMain = $_GET['pageNum_RecVoteMain'];
}
$startRow_RecVoteMain = $pageNum_RecVoteMain * $maxRows_RecVoteMain;
mysql_select_db($database_connVoteSystem, $connVoteSystem);
$query_RecVoteMain = "SELECT votemain.vote_id,votemain.vote_name,votemain.vote_time,SUM(voteitem.vote_count) AS sumVote FROM votemain INNER JOIN voteitem ON votemain.vote_id = voteitem.vote_id GROUP BY votemain.vote_id ORDER BY votemain.vote_time DESC";
$query_limit_RecVoteMain = sprintf("%s LIMIT %d, %d", $query_RecVoteMain, $startRow_RecVoteMain, $maxRows_RecVoteMain);
$RecVoteMain = mysql_query($query_limit_RecVoteMain, $connVoteSystem) or die(mysql_error());
$row_RecVoteMain =
mysql_fetch_assoc($RecVoteMain);
if (isset($_GET['totalRows_RecVoteMain'])) {
$totalRows_RecVoteMain = $_GET['totalRows_RecVoteMain'];
} else {
$all_RecVoteMain = my
sql_query($query_RecVoteMain);
$totalRows_RecVoteMain = mysql_num_rows($all_RecVoteMain);
}
$totalPages_RecVoteMain = ceil($totalRows_RecVoteMain/$maxRows_RecVoteMain)-1;
$queryString_RecVoteMain = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_RecVoteMain") == false &&
stristr($param, "totalRows_RecVoteMain") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_RecVoteMain = "&" . implode("&", $newParams);
}
}
$queryString_RecVoteMain = sprintf("&totalRows_RecVoteMain=%d%s", $totalRows_RecVoteMain, $queryString_RecVoteMain);
$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 ($_GET);
while (list ($key, $val) = each ($_GET)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepURL .= "&".$key."=".urlencode($val);
}
}
// add the URL parameters to the MM_keepURL string
if(isset($_POST)){
reset ($_POST);
while (list ($key, $val) = each ($_POST)) {
$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."&".$MM_keepForm;
if (strlen($MM_keepBoth) > 0) $MM_keepBoth = substr($MM_keepBoth, 1);
if (strlen($MM_keepURL) > 0) $MM_keepURL = substr($MM_keepURL, 1);
if (strlen($MM_keepForm) > 0) $MM_keepForm = substr($MM_keepForm, 1);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网站投票系统</title>
<script language="JavaScript" type="text/
JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++