📄 vote.php
字号:
<?
require("userdata/style.php");
require("global.php");
require("globalpost.php");
// 灌水预防-----------
if ($flood_control && $username && !flood_limit($username,$flood_control)) {
require("header.php");echo"$headertp";
headguide($headguide_des,$headguide_l2,"灌水预防警告");
$status="* 灌水预防机制已经打开,在 $flood_control 秒内不能发贴";
print_err();
require("footer.php");echo"$footertp";
exit;
}
//---------------------------
if (!$step) {
require("header.php");echo"$headertp";
headguide($headguide_des,$headguide_l2,"发起新投票");
$status="发起一个新的投票统计";
print_form();
require("footer.php");echo"$footertp";
exit;
} elseif($step==2) {
//----Check-------
$check=check_data("vote");
if ($check) {
if (empty($usericon)) $usericon="ran";
if (!isset($articledes)) $articledes=""; else $articledes=stripslashes($articledes);
//-----Check the input------
$articlecontent=stripslashes($articlecontent); $articlecontent=safe_convert($articlecontent);
$articletitle=stripslashes($articletitle); $articletitle=str_replace(",",",",$articletitle);
$articletitle=safe_convert($articletitle); $articledes=safe_convert($articledes);
$selections=safe_convert($selections); $sellist=explode("<br>",$selections);
if ($votetype!="bar") $votetype="pie"; //decide the type of vote
if (file_exists("{$idpath}forum$forumid/list.php")) {
$filecc=readfromfile("{$idpath}forum$forumid/list.php");
//-----Let's get the Filename ( f_xxx )
$filename=get_next_filename($filecc,$forumid);
}
else $filename="f_1";
$lm=$articletitle.",".$username.",".$timestamp;
$newlist="$articletitle|$username|$timestamp|$articledes|$usericon|$filename|0|0|$lm|0|1|\n";
$px_newpost="$articletitle|$username|$timestamp|$usericon|$filename|$forumid\n";
writetofile("bbsdata/newpost.php",$px_newpost,"a+");
if (isset($filecc)) $newlist.=$filecc;
$newlist=push_heldtopics($newlist); //----push the Held Topics to the beginning of the list
writetofile("{$idpath}forum$forumid/list.php",$newlist); //--OK, write to the list-----
$file_line=array($articletitle,
$username,
$articlecontent,
$timestamp,
convert_ip($REMOTE_ADDR),
$usericon,
"0");
$line_cc=implode("|",$file_line)."|\n";
writetofile("{$idpath}forum$forumid/$filename",$line_cc);//------write to f_xxx -------
//----拆分数据-------
$selcount=min(count($sellist),6);
for ($k=0; $k<$selcount; $k++) if ($sellist[$k]==="") unset($sellist[$k]); else $sellist[$k]="$sellist[$k],0";
$list=implode("|",$sellist);
writetofile("{$idpath}forum$forumid/$filename.sta","$votetype|\n".$list);
send_suc();
jump_page("thread.php?forumid=$forumid","发起新投票成功");
} else {
require("header.php");echo"$headertp";
headguide($headguide_des,$headguide_l2,"发生错误");
print_err();
require("footer.php");echo"$footertp";
exit;
}
}
function print_form() {
global $login_status,$status,$articletitle,$articlecontent,$forumid,$filename,$idpath,
$article,$bordercolor,$subcolor,$titlecolor,$timestamp,$article_color1,$article_color2,
$max_post_length,$tablewidth,$ftbcode_post,$timestamp,$postjs,$ftbemote,$panelbar,$loginform;
//echo $postjs;
?>
<script language="JavaScript1.2">
<!--
helpstat = false;
stprompt = true;
basic = false;
clckcnt = 0;
var postmaxchars = <?=$max_post_length?>;
ie = (document.all)? true:false
if (ie){
function ctlent(eventobject){if(event.ctrlKey && window.event.keyCode==13){this.document.FORM.submit();}}
}
function clckcntr() {
clckcnt++;
if(clckcnt > 1) {
if(clckcnt > 2) { return false; }
alert('贴子已经发出了......\n\n' + '请等待片刻......\n\n' + '不要重复按提交键,谢谢!');
return false;
}
return true;
}
function thelp(swtch){
if (swtch == 1){
basic = false;
stprompt = false;
helpstat = true;
} else if (swtch == 0) {
helpstat = false;
stprompt = false;
basic = true;
} else if (swtch == 2) {
helpstat = false;
basic = false;
stprompt = true;
}
}
function AddText(NewCode) {
document.FORM.articlecontent.value+=NewCode
}
function validate(theform) {
if (theform.articletitle.value=="" || theform.articlecontent.value=="") {
alert("请完成标题和内容栏目.");
return false; }
if (postmaxchars != 0) {
if (theform.articlecontent.value.length > <?=$max_post_length?>) {
alert("你的信息太长了.\n\n请限制在 <?=$max_post_length?> 字节以内.\n当前已有 "+theform.articlecontent.value.length+" 字节.");
return false; }
else { return true; }
} else { return true; }
}
function checklength(theform) {
if (postmaxchars != 0) { message = "\n最大的字符为 <?=$max_post_length?> 字节."; }
else { message = ""; }
alert("你的信息已经有 "+theform.articlecontent.value.length+" 字节."+message);
}
//-->
</script>
<table width=<?=$tablewidth?> border=0 cellspacing=0 bgcolor=<?=$bordercolor?> cellpadding=0 align=center>
<form name="FORM" method=POST action="vote.php"><tr>
<td>
<table cellspacing=1 cellpadding=4 width=100% border=0>
<tr>
<td colspan=3 bgcolor=<?=$titlecolor?>> <b class=title><?=$status?></b>
</td>
</tr>
<tr bgcolor=<?=$article_color1?>>
<td valign=top width=25%><b>投票主题</b>:</td>
<td valign=top width=50%>
<input <? if (isset($articletitle)) echo "value='$articletitle'"; ?> maxlength=45 size=45 name=articletitle style="background-color:#FEFEFF; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#E5F0FF'" onMouseOut = "this.style.backgroundColor = ''">
</td>
<td align=center rowspan=2 bgcolor=<?=$article_color1?> width=25%>
<table cellspacing=0 cellpadding=3 border=0>
<tr>
<td align=center>
<table cellspacing=0 cellpadding=0 width=70 bgcolor=<?=$bordercolor?> border=0><tr><td height=1></td></tr></table>
<table cellspacing=0 cellpadding=3 width=70 border=1 bordercolor=<?=$bordercolor?>>
<tr bgcolor=<?=$subcolor?>>
<td align=middle><b><? echo get_time($timestamp); ?></b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align=middle>
<table cellspacing=0 cellpadding=0 width=70 bgcolor=<?=$bordercolor?> border=0><tr><td height=1></td></tr></table>
<table cellspacing=0 cellpadding=3 width=70 border=1 bordercolor=<?=$bordercolor?>>
<tr bgcolor=<?=$subcolor?>>
<td align=center>
<? echo get_date($timestamp); ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor=<?=$article_color2?>>
<td><b>投票描述</b>:</td>
<td>
<input maxlength=45 size=45 name=articledes style="background-color:#FEFEFF; border: 1 double #B4B4B4" onMouseOver="this.style.backgroundColor = '#E5F0FF'" onMouseOut="this.style.backgroundColor = ''">
</td>
</tr>
<?
if ($login_status==0) {
print $loginform;
}
?>
<tr bgcolor=<?=$article_color1?>>
<td valign=top><b>投票选项</b>:<br><br>
请填写投票选项<br>每一行将做为一个选项<br>最多可以有 <b>6</b> 个选项<br><br>
</td>
<td valign=middle>
<textarea name=selections rows=5 wrap=hard cols=50 style="background-color:#FEFEFF; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#f3f3f3'" onMouseOut = "this.style.backgroundColor = ''"><? if (isset($selections)) echo $selections; ?></textarea>
</td>
<td valign=top>
<b>投票模式:</b><br><br>
<input onfocus=this.blur() type=radio value=pie name=votetype><font face=verdana> 3D Pie饼形图 </font><br> <input onfocus=this.blur() type=radio value=bar name=votetype CHECKED> 条形统计图
</td>
</tr>
<TR>
<TD bgColor=<?=$article_color1?>><B>你的心情</B>:<br>
<a onfocus=this.blur() href="javascript:this.location.reload()">刷新</a>页面<br>可以获得不同的心情图</TD>
<TD colspan=2 vAlign=top bgColor=<?=$article_color1?>>
<?
$listmin=0;
$listmax=19;
for ($j=$listmin; $j<=$listmax; $j++) {
print ("<INPUT type=radio value='$j.gif' name='usericon'><IMG height=16 src=\"images/emotion/$j.gif\" width=16 border=0> ");
if ($j-$listmin==9) echo"<br>";
}
?>
</TD>
</TR>
<tr bgcolor=<?=$article_color1?>>
<td valign=top>
<b>投票内容介绍</b>:<br><font face=verdana>
<br>
HTML 代码不可用<br>
<a onfocus=this.blur() href="javascript:openScript('ftbcode.php',580,400)">ftb Code</a> 可用<br>
点击 <a onfocus=this.blur() href="javascript:openScript('ftbcode.php',580,400)"><b>这里</b></a> 看使用方法 <br><br>
<b>ftb代码选项</b>:<br><br><font face=verdana><?
echo '[img] -';
if ($ftbcode_post['pic']) echo ' 开启'; else echo ' 关闭';
echo '<br>[flash] -';
if ($ftbcode_post['flash']) echo ' 开启'; else echo ' 关闭';
echo '<br>[size] -';
if ($ftbcode_post['fontsize']) echo ' 开启'; else echo ' 关闭';
?></font>
</td>
<td colspan=2 align="left" valign=middle>
<?=$panelbar?>
<textarea onkeydown=ctlent() name=articlecontent rows=6 wrap=hard cols=85 style="background-color:#FEFEFF; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#f3f3f3'" onMouseOut = "this.style.backgroundColor = ''"><? if (isset($articlecontent)) echo $articlecontent; ?></textarea>
<a onfocus=this.blur() href="javascript:checklength(document.FORM);">[查看帖子长度]</a>
</td>
</tr>
<tr bgcolor=<?=$article_color2?> align=center>
<td colspan=3>
<input onclick="return clckcntr();" type=submit value="发 表" style="font-family: 宋体, Arial; font-size: 9pt; height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'" onfocus=this.blur()>
<input type=hidden value=2 name="step">
<input type=hidden value="<?=$forumid?>" name="forumid">
<? if (isset($filename)) echo "<input type=hidden value='$filename' name='filename'>"; ?>
<? if (isset($article)) echo "<input type=hidden value='$article' name='article'>"; ?>
<input type=reset value="重 填" style="font-family: 宋体, Arial; font-size: 9pt; height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'" onfocus=this.blur()>
</td>
</tr>
<tr>
<td colspan=3 bgcolor=<?=$titlecolor?> class=title>您必须是本论坛的注册会员才可发表投票!</td>
</tr>
</table></td></tr>
</form></table>
<?
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -