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

📄 polls.php

📁 集成了投票调查、流量统计、文件上传、留言版、论坛、软件下载、文章赏析、通讯录、网上购物 等板块 管理账户为peilei 密码为800901
💻 PHP
字号:
<!-- polls //-->
<?php
  $hide = tep_hide_session_id();

function pollnewest() {
	global $customer_id;
	if (!isset($customer_id)) {
		$extra_query=" and poll_type='0' ";
		}
	if (DISPLAY_POLL_HOW==2) {
		$order = 'voters DESC';
 		} else {
		$order = 'timestamp DESC';
		}
	$query= tep_db_query("select pollid FROM phesis_poll_desc where poll_open='0'".$extra_query."order by ".$order);
	$count=tep_db_num_rows($query);
	$pollid = false;
	if (!DISPLAY_POLL_HOW==0 || $count==1) {
		if ($result=tep_db_fetch_array($query)) {
			$pollid = $result['pollid'];
		}
	} else {
		if ($count==0) $count=1;
		mt_srand((double) microtime() * 1000000);
		$rand = mt_rand(1,$count);
		for($i=0;$i<$rand;$i++) {
			$result=tep_db_fetch_array($query);
			$pollid = $result['pollid'];
			}
	}
	return $pollid;
}
$pollid=pollnewest();
if ($pollid) {
?>
  <tr>
	<td>
<?php
	$poll_query=tep_db_query("select polltitle, voters from phesis_poll_desc where pollid=$pollid and poll_open='0'");
	$poll_details=tep_db_fetch_array($poll_query);
	$info_box_contents = array();
  	$info_box_contents[] = array('align' => 'center',
                               'text'  => $poll_details['polltitle']
                              );
  	new infoBoxHeading($info_box_contents, false, false);
	$url = sprintf("pollbooth.php?op=results&amp;pollid=%d", $pollid);
 	$content =  "<input type=\"hidden\" name=\"pollid\" value=\"".$pollid."\">\n";
  	$content .=  "<input type=\"hidden\" name=\"forwarder\" value=\"".$url."\">\n";
	for ($i=1;$i<=12;$i++) {
	      $query=tep_db_query("select pollid, optiontext, optioncount, voteid from phesis_poll_data where (pollid=$pollid) and (voteid=$i)");
      	if ($result=tep_db_fetch_array($query)) {
     	 		if ($result['optiontext']) {
       		$content.= "<input type=\"radio\" name=\"voteid\" value=\"".$i."\">".$result['optiontext']."<br>\n";
       		}
    		}
	}
	$content .= "<br><center><input type=\"submit\" value=\""._VOTE."\"></center><br>\n";
	$query=tep_db_query("select sum(optioncount) as sum from phesis_poll_data where pollid=$pollid");
	if ($result=tep_db_fetch_array($query)) {
		$sum=$result['sum'];
	}
	$content .= "<center>[ <a href=\"pollbooth.php?op=results&amp;pollid=$pollid\">"._RESULTS."</a> | <a href=\"pollbooth.php?op=list\">"._POLLS."</a> ]";
  	$content .= "</br><center>" . $sum . " "._VOTES."</center>\n";
$info_box_contents = array();
$info_box_contents[] = array('form' => '<form name="poll" method="post" action="pollcollect.php">',
                               'align' => 'left',
                               'text'  =>   $content
                              );
 new infoBox($info_box_contents);
?>
	</td>
  </tr>
<?php
} elseif (SHOW_NOPOLL==1) {
?>
  <tr>
	<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
                               'text'  => _NOPOLLS
                            );
new infoBoxHeading($info_box_contents, false, false);
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
                              'text'  => _NOPOLLSCONTENT
                             );
new infoBox($info_box_contents);
?>
	</td>
  </tr>
<?php
}
?>
<!-- polls-eof //-->

⌨️ 快捷键说明

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