国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.0KB

  1. <?php
  2. /**
  3. * 投票
  4. *
  5. * @version $Id: vote.php$
  6. * @package DedeBIZ.Site
  7. * @copyright Copyright (c) 2022, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require(dirname(__FILE__)."/../system/common.inc.php");
  12. require(DEDEINC."/dedevote.class.php");
  13. require(DEDEINC."/memberlogin.class.php");
  14. require(DEDEINC."/userlogin.class.php");
  15. $member = new MemberLogin;
  16. $memberID = $member->M_LoginID;
  17. $loginurl = $cfg_basehost."/user";
  18. $ENV_GOBACK_URL = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
  19. if (empty($dopost)) $dopost = '';
  20. $aid = (isset($aid) && is_numeric($aid)) ? $aid : 0;
  21. if ($aid == 0) die("dedebiz");
  22. if ($aid == 0) {
  23. ShowMsg("没指定投票项目的ID", "-1");
  24. exit();
  25. }
  26. $vo = new DedeVote($aid);
  27. $rsmsg = '';
  28. $row = $dsql->GetOne("SELECT * FROM `#@__vote` WHERE aid='$aid'");
  29. //判断是否允许游客进行投票
  30. if ($row['isallow'] == 1) {
  31. if (!$member->IsLogin()) {
  32. ShowMsg('请先登录再进行投票', $loginurl);
  33. exit();
  34. }
  35. }
  36. if ($dopost == 'send') {
  37. if (!empty($voteitem)) {
  38. $rsmsg = "<br>您方才的投票状态:".$vo->SaveVote($voteitem)."<br>";
  39. } else {
  40. $rsmsg = "<br>您刚才没选择任何投票项目<br>";
  41. }
  42. if ($row['isenable'] == 1) {
  43. ShowMsg('此投票项未启用,暂时不能进行投票', $ENV_GOBACK_URL);
  44. exit();
  45. }
  46. }
  47. $voname = $vo->VoteInfos['votename'];
  48. $totalcount = $vo->VoteInfos['totalcount'];
  49. $starttime = GetDateMk($vo->VoteInfos['starttime']);
  50. $endtime = GetDateMk($vo->VoteInfos['endtime']);
  51. $votelist = $vo->GetVoteResult("98%", 30, "30%");
  52. //判断是否允许被查看
  53. $admin = new userLogin;
  54. if ($dopost == 'view') {
  55. if ($row['view'] == 1 && empty($admin->userName)) {
  56. ShowMsg('此投票项不允许查看结果', $ENV_GOBACK_URL);
  57. exit();
  58. }
  59. }
  60. //显示模板(简单PHP文件)
  61. include(DEDETEMPLATE.'/plus/vote.htm');