【php开源代码栏目提醒】:本文主要为网学会员提供voteMain.php,希望对需要voteMain.php网友有所帮助,学习一下!
<?php require_once('Connections/connVoteSystem.php'); ?>
<?php
$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";
$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 = my
sql_fetch_assoc($RecVoteMain);
if (isset($_GET['totalRows_RecVoteMain'])) {
$totalRows_RecVoteMain = $_GET['totalRows_RecVoteMain'];
} else {
$all_RecVoteMain =
mysql_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++].src=a[i];}}
}
//-->
</script>
</head>
<body leftmargin="0" topmargin="0">
<table width="400" border="0" align="center">
<tr>
<td colspan="2" bgcolor="#0099FF"><div align="center"><strong><font size="3">投票
系统主画面</font></strong></div></td>
</tr>
<tr>
<td> </td>
<td><div align="right"><a href="voteAdminLogin.php"><font size="3">选举委员会</font></a></div></td>
</tr>
</table>
<table width="400" border="0" align="center" cellpadding="4" cellspacing="0">
<tr>
<td align="right" valign="top"><?php if ($totalRows_RecVoteMain > 0) { // Show if recordset not empty ?>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><font size="-1">目前共有</font><font size="-1"> <?php echo $totalRows_RecVoteMain ?> 则投票活动</font>
<table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC">
<tr bgcolor="#0066CC">
<td><font color="#FFFFFF" size="-