国内流行的内容管理系统(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.

vote_add.php 3.1KB

2 years ago
2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * 投票模块
  4. *
  5. * @version $Id: vote_add.php 1 23:54 2010年7月20日Z tianya $
  6. * @package DedeBIZ.Administrator
  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__)."/config.php");
  12. require_once(DEDEINC."/dedevote.class.php");
  13. require_once(DEDEINC."/helpers/filter.helper.php");
  14. CheckPurview('plus_投票模块');
  15. if (empty($dopost)) $dopost = "";
  16. if (empty($isarc)) $isarc = 0;
  17. if ($dopost == "save" && $isarc == 0) {
  18. CheckCSRF();
  19. $starttime = GetMkTime($starttime);
  20. $endtime = GetMkTime($endtime);
  21. $voteitems = "";
  22. $j = 0;
  23. for ($i = 1; $i <= 15; $i++) {
  24. if (!empty(${"voteitem".$i})) {
  25. $j++;
  26. $voteitems .= "<v:note id=\\'$j\\' count=\\'0\\'>".${"voteitem".$i}."</v:note>\r\n";
  27. }
  28. }
  29. $inQuery = "INSERT INTO `#@__vote`(votename,starttime,endtime,totalcount,ismore,votenote,isallow,view,spec,isenable)
  30. VALUES('$votename','$starttime','$endtime','0','$ismore','$voteitems','$isallow','$view','$spec','$isenable'); ";
  31. if (!$dsql->ExecuteNoneQuery($inQuery)) {
  32. ShowMsg("增加投票失败,请检查数据是否非法", "-1");
  33. exit();
  34. }
  35. $aid = $dsql->GetLastID();
  36. $vt = new DedeVote($aid);
  37. $vote_content = $vt->GetVoteForm();
  38. $vote_content = preg_replace(array("#/#", "#([\r\n])[\s]+#"), array("\/", " "), $vote_content); //取出内容中的空白字符并进行转义
  39. $vote_content = 'document.write("'.$vote_content.'");';
  40. $vote_file = DEDEDATA."/vote/vote_".$aid.".js";
  41. file_put_contents($vote_file, $vote_content);
  42. ShowMsg("成功增加一组投票", "vote_main.php");
  43. exit();
  44. } else if ($dopost == "save" && $isarc == 1) {
  45. $starttime = GetMkTime($starttime);
  46. $endtime = GetMkTime($endtime);
  47. $voteitems = "";
  48. $j = 0;
  49. for ($i = 1; $i <= 15; $i++) {
  50. if (!empty(${"voteitem".$i})) {
  51. $j++;
  52. $voteitems .= "<v:note id=\\'$j\\' count=\\'0\\'>".${"voteitem".$i}."</v:note>\r\n";
  53. }
  54. }
  55. $inQuery = "INSERT INTO `#@__vote`(votename,starttime,endtime,totalcount,ismore,votenote,isallow,view,spec,isenable)
  56. VALUES('$votename','$starttime','$endtime','0','$ismore','$voteitems','$isallow','$view','$spec','$isenable'); ";
  57. if (!$dsql->ExecuteNoneQuery($inQuery)) {
  58. ShowMsg("增加投票失败,请检查数据是否非法", "-1");
  59. exit();
  60. }
  61. $aid = $dsql->GetLastID();
  62. $vt = new DedeVote($aid);
  63. $vote_content = $vt->GetVoteForm();
  64. $vote_content = preg_replace(array("#/#", "#([\r\n])[\s]+#"), array("\/", " "), $vote_content); //取出内容中的空白字符并进行转义
  65. $vote_content = 'document.write("'.$vote_content.'");';
  66. $vote_file = DEDEDATA."/vote/vote_".$aid.".js";
  67. file_put_contents($vote_file, $vote_content);
  68. ShowMsg("成功增加一组投票", "vote_main.php?issel=1&aid=".$aid);
  69. exit();
  70. }
  71. $startDay = time();
  72. $endDay = AddDay($startDay, 30);
  73. $startDay = GetDateTimeMk($startDay);
  74. $endDay = GetDateTimeMk($endDay);
  75. include DedeInclude('templets/vote_add.htm');