📄 result.php
字号:
<?php require_once('Connections/vote.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;
}
}
$colname_rsResult = "-1";
if (isset($_GET['vid'])) {
$colname_rsResult = (get_magic_quotes_gpc()) ? $_GET['vid'] : addslashes($_GET['vid']);
}
mysql_select_db($database_vote, $vote);
$query_rsResult = sprintf("SELECT * FROM veiw3 WHERE vote_id = %s ORDER BY vote_count DESC", GetSQLValueString($colname_rsResult, "int"));
$rsResult = mysql_query($query_rsResult, $vote) or die(mysql_error());
$row_rsResult = mysql_fetch_assoc($rsResult);
$totalRows_rsResult = mysql_num_rows($rsResult);
$colname_rsTotal = "-1";
if (isset($_GET['vid'])) {
$colname_rsTotal = (get_magic_quotes_gpc()) ? $_GET['vid'] : addslashes($_GET['vid']);
}
mysql_select_db($database_vote, $vote);
$query_rsTotal = sprintf("SELECT * FROM view4 WHERE vote_id = %s", GetSQLValueString($colname_rsTotal, "int"));
$rsTotal = mysql_query($query_rsTotal, $vote) or die(mysql_error());
$row_rsTotal = mysql_fetch_assoc($rsTotal);
$totalRows_rsTotal = mysql_num_rows($rsTotal);
?><!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>查看投票结果</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="96%" border="1" align="center" frame="below" rules="none">
<tr>
<td align="left" valign="bottom" scope="col"><img src="images/logo.gif" width="160" height="33" /></td>
<td align="left" valign="bottom" scope="col"><a href="index.php">系统首页</a></td>
<td align="right" valign="bottom" scope="col"><a href="admin.php">后台管理 </a></td>
<td align="right" valign="bottom" scope="col"><?php echo date("Y年n月j日"); ?> </td>
</tr>
</table>
<br />
<table width="96%" border="1" align="center" bordercolor="#CCCCCC">
<caption>
“<?php echo $row_rsResult['vote_title']; ?>”投票结果(总票数:<?php echo $row_rsTotal['total']; ?>)<br /><br />
</caption>
<tr>
<th width="42%" bgcolor="#666666" class="title">选项</th>
<th width="58%" bgcolor="#666666" class="title">得票数</th>
</tr>
<?php do { ?>
<tr>
<td height="22" nowrap="nowrap"> <?php echo $row_rsResult['vote_description']; ?></td>
<td height="22" align="center"><img src="graph.php?width=<?php echo 200 * $row_rsResult['vote_count'] / $row_rsTotal['total']; ?>&text=<?php echo $row_rsResult['vote_count'] . " 票"; ?>" /></td>
</tr>
<?php } while ($row_rsResult = mysql_fetch_assoc($rsResult)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($rsResult);
mysql_free_result($rsTotal);
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -