⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.php

📁 希望这个对大家有用
💻 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;
}
}

mysql_select_db($database_vote, $vote);
$query_rsVote = "SELECT * FROM view1 ORDER BY vote_time DESC";
$rsVote = mysql_query($query_rsVote, $vote) or die(mysql_error());
$row_rsVote = mysql_fetch_assoc($rsVote);
$totalRows_rsVote = mysql_num_rows($rsVote);
?><!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="100%" border="1" frame="below" rules="none">
  <tr>
    <td align="left" valign="bottom" scope="col"><img src="images/logo.gif" width="160" height="33" /></td>
    <td align="right" valign="bottom" scope="col"><a href="admin.php">后台管理&nbsp;</a></td>
    <td align="right" valign="bottom" scope="col"><?php echo date("Y年n月j日"); ?>&nbsp;</td>
  </tr>
</table>
<br />
<?php if ($totalRows_rsVote > 0) { // Show if recordset not empty ?>
  &nbsp;&nbsp;
  目前共有 <?php echo $totalRows_rsVote ?> 项投票活动<br /><br />
  <table width="99%" border="1" align="center" cellpadding="4" bordercolor="#999999">
    <tr bgcolor="#666666">
      <th bgcolor="#666666" class="title">投票主题</th>
      <th bgcolor="#666666" class="title">设立时间</th>
      <th bgcolor="#666666" class="title">总投票数</th>
      <th bgcolor="#666666" class="title">操作</th>
    </tr>
    <?php do { ?>
      <tr>
        <td><?php echo $row_rsVote['vote_title']; ?></td>
        <td align="center"><?php echo $row_rsVote['vote_time']; ?></td>
        <td align="center"><?php echo $row_rsVote['total']; ?></td>
        <td align="center"><a href="voting.php?vid=<?php echo $row_rsVote['vote_id']; ?>">我要投票</a>&nbsp;<a href="result.php?vid=<?php echo $row_rsVote['vote_id']; ?>"">查看结果</a></td>
      </tr>
      <?php } while ($row_rsVote = mysql_fetch_assoc($rsVote)); ?>
  </table>
  <?php } // Show if recordset not empty ?>
  <?php if ($totalRows_rsVote == 0) { // Show if recordset empty ?>
    <table width="300" border="1" align="center">
      <tr>
        <th bgcolor="#666666" scope="col"><span class="title">提示信息</span></th>
    </tr>
      <tr>
        <td height="56" align="center">目前暂时没有任何投票活动。</td>
    </tr>
    </table>
    <?php } // Show if recordset empty ?>
</body>
</html>
<?php
mysql_free_result($rsVote);
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -