投票管理程序
表结构
CREATE TABLE poll(Poll_Id INT (11) not null AUTO_INCREMENT,Poll_Name char(50) ,Poll_Del INT (10) DEFAULT '0' , PRIMARY KEY (Poll_Id))
CREATE TABLE pollsele(Pollsele_Id INT (11) not null AUTO_INCREMENT,Pollsele_Name char(50) ,Poll_Del INT (10) DEFAULT '0' , Pollsele_poll_Id INT (10) ,pollsele_num int (10), PRIMARY KEY (Pollsele_Id))
-------------------------------------------------------------------------------------------------
poll.php //主程序
<? $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select poll_id,Poll_Name from poll where poll_del='1'";
@$result = mysql_query($sql);
$myrow=mysql_fetch_row($result);
echo "<table align=center bgcolor=aabbcc width=250 hight=450 border=0 style='border:1px solid rgb(0,0,0)'>";
echo "<td align=center bgcolor=99aabb style='border:1px solid rgb(255,255,255)'>";
echo "$myrow[1]";
$sql="select Pollsele_Name,pollsele_poll_id from pollsele where pollsele_del='0' and pollsele_poll_id='$myrow[0]'";
@$result = mysql_query($sql);
echo "<FORM ACTION='pollsee.php?poll_id=$myrow[0]' METHOD='post' target=_blank>";
echo "<p align=center>";
while($myrow=mysql_fetch_row($result))
{
echo "<input type='radio' name=toupiao value='$myrow[0]'>$myrow[0]";
echo " "; }
echo "<br>"; echo "<br>";
echo "<input type=submit name=submit value='投票' >";
echo "</p>";
echo "</form>"; echo "</td>";
echo "</table>";
mysql_close();
echo "<br>";
echo "<p align=right>";
echo "<a href=poll_input>管理</a>"; echo "</p>"; ?>
-----------------------------------------------------------------------
poll_input.php //添加主题
<? $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select poll_id,poll_name,poll_del from poll";
echo "<table width=300 hight=560 bgcolor=aabbcc align=center style='border:1px solid rgb(0,0,0)'>";
$result=mysql_query($sql);
while($my=mysql_fetch_row($result))
{
echo "<tr>";echo "<td align=center width=50 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'>";echo $my[0];echo "</td>";
echo "<td align=center width=200 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'><a href=pollsele.php?id=$my[0]>$my[1]</a></td>";
echo "<td align=center width=50 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'>";echo $my[2];echo "</td>";
echo "</tr>";
} echo "</table>";
?>
<html>
<head>
<?
if($submit2!="添加")
{ echo "<p align=center>";
echo "<FORM ACTION='poll_input.php' METHOD='post'>";
echo "<font color=004080>主题:</font>";
echo "<input type=text name=title size=30 value=''>";
echo "<input type=submit name=submit2 value='添加'>";
echo "</p>";
echo"</form>"; }
else
{$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select poll_name from poll where poll_name='$title'";
mysql_query($sql);
$sql="insert into poll values('','$title','')";
mysql_query($sql);
mysql_close();
echo "<META HTTP-EQUIV=REFRESH CONTENT='1; URL=poll_input.php'>"; }
if($submit1!="有效"&&$submit3!="删除")
{ echo "<p align=center>";
echo "<FORM ACTION='poll_input.php' METHOD='post'>";
echo "<font color=004080>设置主题:</font>";
echo "<select name='sele' size=1>";
$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select Poll_Id from poll";
$result = mysql_query($sql);
mysql_close();
while($myrow=mysql_fetch_row($result))
{ echo "<option value='$myrow[0]'>$myrow[0]";}
echo "</select>";
echo "<input type=submit name=submit1 value='有效'>";
echo "<input type=submit name=submit3 value='删除'>";
echo "</p>";
echo "</FORM>";
}
else
{
if($submit1=="有效")
{
$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="update poll set Poll_Del='0'";
$result = mysql_query($sql);
$sql="update poll set Poll_Del='1' where poll_id='$sele'";
$result = mysql_query($sql);
mysql_close();
echo "<META HTTP-EQUIV=REFRESH CONTENT='1; URL=poll_input.php'>"; }
else
{ $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="delete from poll where poll_id='$sele'";
$result = mysql_query($sql);
$sql="delete from pollsele where pollsele_poll_id='$sele'";
mysql_query($sql);
mysql_close();
echo "<META HTTP-EQUIV=REFRESH CONTENT='1; URL=poll_input.php'>"; }
}
?>
--------------------------------------------------------------------
pollsele.php //添加选项
<? $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select pollsele_id,pollsele_name,pollsele_del,pollsele_num from pollsele where pollsele_poll_id='$id'";
echo "<table width=300 hight=560 align=center bgcolor=aabbcc style='border:1px solid rgb(0,0,0)' >";
@$result=mysql_query($sql);
while($my=mysql_fetch_row($result))
{
echo "<tr>";echo "<td align=center width=50 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'>";echo $my[0];echo "</td>";
echo "<td align=center width=200 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'>$my[1]</td>";
echo "<td align=center width=50 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'>";echo $my[2];echo "</td>";
echo "<td align=center width=50 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'>";echo $my[3];echo "</td>";
echo "</tr>";
} echo "</table>";
?>
<html>
<head>
<?
if($submit2!="添加")
{ echo "<p align=center>";
echo "<FORM ACTION='pollsele.php?id=$id' METHOD='post'>";
echo "<font color=004080>选项:</font></td>";
echo "<input type=text name=title size=30 value=''>";
echo "<input type=submit name=submit2 value='添加'>";
echo "</p>";
echo"</form>"; }
else
{$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="insert into pollsele values('','$title','','$id','')";
mysql_query($sql);
mysql_close();
echo "<META HTTP-EQUIV=REFRESH CONTENT='1; URL=pollsele.php?id=$id'>"; }
if($submit1!="有效"&&$submit3!="无效")
{ echo "<p align=center>";
echo "<FORM ACTION='pollsele.php?id=$id' METHOD='post'>";
echo "<font color=004080>设置选项:</font>";
echo "<select name='sele' size=1>";
$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select Pollsele_Id from pollsele where pollsele_poll_id='$id'";
$result = mysql_query($sql);
mysql_close();
while($myrow=mysql_fetch_row($result))
{ echo "<option value='$myrow[0]'>$myrow[0]";}
echo "</select>";
echo "<input type=submit name=submit1 value='有效'>";
echo "<input type=submit name=submit3 value='无效'>";
echo "</p>";
echo "</FORM>";
}
else
{ $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
if ($submit1=="有效")
{
$sql="update pollsele set Pollsele_Del='0' where pollsele_id='$sele'";
$result = mysql_query($sql);}
else
{
$sql="update pollsele set Pollsele_Del='1' where pollsele_id='$sele'";
$result = mysql_query($sql); }
mysql_close();
echo "<META HTTP-EQUIV=REFRESH CONTENT='1; URL=pollsele.php?id=$id'>"; }
?>
----------------------------------------------------------------------
pollsee.php //投票结果
<? if ($toupiao!=""){
$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select Pollsele_Name,pollsele_num from pollsele where pollsele_name='$toupiao'";
@$result = mysql_query($sql);
$myrow=mysql_fetch_row($result);
$poll_num=$myrow[1];
$poll_num=$poll_num+1;
$sql="update pollsele set Pollsele_num='$poll_num' where pollsele_name='$toupiao'";
mysql_query($sql);
$sql="select Poll_Name from poll where poll_id='$poll_id'";
@$result = mysql_query($sql);
$title=mysql_fetch_row($result);
echo "<p align=center>";
echo $title[0]; echo "</p>";
echo "<br>";
$sql="select Pollsele_Name,pollsele_num from pollsele where pollsele_del='0' and pollsele_poll_id='$poll_id'";
@$result = mysql_query($sql);
echo "<table align=center bgcolor=aabbcc style='border:1px solid rgb(0,0,0)'>";
while($myrow=mysql_fetch_row($result))
{ echo "<tr>"; echo "<td width=150 bgcolor=99aabb style='border:1px solid rgb(255,255,255)'>";
echo $myrow[0];echo "</td><td width=50 bgcolor=99aabb style='border:1px solid rgb(255,255,255)'>";echo $myrow[1]; echo "</td></tr>";} echo "</table>"; }
else
{echo "<font color=red>你不能投空票!!!</font>";}
?>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
表结构
CREATE TABLE poll(Poll_Id INT (11) not null AUTO_INCREMENT,Poll_Name char(50) ,Poll_Del INT (10) DEFAULT '0' , PRIMARY KEY (Poll_Id))
CREATE TABLE pollsele(Pollsele_Id INT (11) not null AUTO_INCREMENT,Pollsele_Name char(50) ,Poll_Del INT (10) DEFAULT '0' , Pollsele_poll_Id INT (10) ,pollsele_num int (10), PRIMARY KEY (Pollsele_Id))
-------------------------------------------------------------------------------------------------
poll.php //主程序
<? $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select poll_id,Poll_Name from poll where poll_del='1'";
@$result = mysql_query($sql);
$myrow=mysql_fetch_row($result);
echo "<table align=center bgcolor=aabbcc width=250 hight=450 border=0 style='border:1px solid rgb(0,0,0)'>";
echo "<td align=center bgcolor=99aabb style='border:1px solid rgb(255,255,255)'>";
echo "$myrow[1]";
$sql="select Pollsele_Name,pollsele_poll_id from pollsele where pollsele_del='0' and pollsele_poll_id='$myrow[0]'";
@$result = mysql_query($sql);
echo "<FORM ACTION='pollsee.php?poll_id=$myrow[0]' METHOD='post' target=_blank>";
echo "<p align=center>";
while($myrow=mysql_fetch_row($result))
{
echo "<input type='radio' name=toupiao value='$myrow[0]'>$myrow[0]";
echo " "; }
echo "<br>"; echo "<br>";
echo "<input type=submit name=submit value='投票' >";
echo "</p>";
echo "</form>"; echo "</td>";
echo "</table>";
mysql_close();
echo "<br>";
echo "<p align=right>";
echo "<a href=poll_input>管理</a>"; echo "</p>"; ?>
-----------------------------------------------------------------------
poll_input.php //添加主题
<? $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select poll_id,poll_name,poll_del from poll";
echo "<table width=300 hight=560 bgcolor=aabbcc align=center style='border:1px solid rgb(0,0,0)'>";
$result=mysql_query($sql);
while($my=mysql_fetch_row($result))
{
echo "<tr>";echo "<td align=center width=50 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'>";echo $my[0];echo "</td>";
echo "<td align=center width=200 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'><a href=pollsele.php?id=$my[0]>$my[1]</a></td>";
echo "<td align=center width=50 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'>";echo $my[2];echo "</td>";
echo "</tr>";
} echo "</table>";
?>
<html>
<head>
<?
if($submit2!="添加")
{ echo "<p align=center>";
echo "<FORM ACTION='poll_input.php' METHOD='post'>";
echo "<font color=004080>主题:</font>";
echo "<input type=text name=title size=30 value=''>";
echo "<input type=submit name=submit2 value='添加'>";
echo "</p>";
echo"</form>"; }
else
{$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select poll_name from poll where poll_name='$title'";
mysql_query($sql);
$sql="insert into poll values('','$title','')";
mysql_query($sql);
mysql_close();
echo "<META HTTP-EQUIV=REFRESH CONTENT='1; URL=poll_input.php'>"; }
if($submit1!="有效"&&$submit3!="删除")
{ echo "<p align=center>";
echo "<FORM ACTION='poll_input.php' METHOD='post'>";
echo "<font color=004080>设置主题:</font>";
echo "<select name='sele' size=1>";
$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select Poll_Id from poll";
$result = mysql_query($sql);
mysql_close();
while($myrow=mysql_fetch_row($result))
{ echo "<option value='$myrow[0]'>$myrow[0]";}
echo "</select>";
echo "<input type=submit name=submit1 value='有效'>";
echo "<input type=submit name=submit3 value='删除'>";
echo "</p>";
echo "</FORM>";
}
else
{
if($submit1=="有效")
{
$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="update poll set Poll_Del='0'";
$result = mysql_query($sql);
$sql="update poll set Poll_Del='1' where poll_id='$sele'";
$result = mysql_query($sql);
mysql_close();
echo "<META HTTP-EQUIV=REFRESH CONTENT='1; URL=poll_input.php'>"; }
else
{ $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="delete from poll where poll_id='$sele'";
$result = mysql_query($sql);
$sql="delete from pollsele where pollsele_poll_id='$sele'";
mysql_query($sql);
mysql_close();
echo "<META HTTP-EQUIV=REFRESH CONTENT='1; URL=poll_input.php'>"; }
}
?>
--------------------------------------------------------------------
pollsele.php //添加选项
<? $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select pollsele_id,pollsele_name,pollsele_del,pollsele_num from pollsele where pollsele_poll_id='$id'";
echo "<table width=300 hight=560 align=center bgcolor=aabbcc style='border:1px solid rgb(0,0,0)' >";
@$result=mysql_query($sql);
while($my=mysql_fetch_row($result))
{
echo "<tr>";echo "<td align=center width=50 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'>";echo $my[0];echo "</td>";
echo "<td align=center width=200 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'>$my[1]</td>";
echo "<td align=center width=50 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'>";echo $my[2];echo "</td>";
echo "<td align=center width=50 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'>";echo $my[3];echo "</td>";
echo "</tr>";
} echo "</table>";
?>
<html>
<head>
<?
if($submit2!="添加")
{ echo "<p align=center>";
echo "<FORM ACTION='pollsele.php?id=$id' METHOD='post'>";
echo "<font color=004080>选项:</font></td>";
echo "<input type=text name=title size=30 value=''>";
echo "<input type=submit name=submit2 value='添加'>";
echo "</p>";
echo"</form>"; }
else
{$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="insert into pollsele values('','$title','','$id','')";
mysql_query($sql);
mysql_close();
echo "<META HTTP-EQUIV=REFRESH CONTENT='1; URL=pollsele.php?id=$id'>"; }
if($submit1!="有效"&&$submit3!="无效")
{ echo "<p align=center>";
echo "<FORM ACTION='pollsele.php?id=$id' METHOD='post'>";
echo "<font color=004080>设置选项:</font>";
echo "<select name='sele' size=1>";
$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select Pollsele_Id from pollsele where pollsele_poll_id='$id'";
$result = mysql_query($sql);
mysql_close();
while($myrow=mysql_fetch_row($result))
{ echo "<option value='$myrow[0]'>$myrow[0]";}
echo "</select>";
echo "<input type=submit name=submit1 value='有效'>";
echo "<input type=submit name=submit3 value='无效'>";
echo "</p>";
echo "</FORM>";
}
else
{ $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
if ($submit1=="有效")
{
$sql="update pollsele set Pollsele_Del='0' where pollsele_id='$sele'";
$result = mysql_query($sql);}
else
{
$sql="update pollsele set Pollsele_Del='1' where pollsele_id='$sele'";
$result = mysql_query($sql); }
mysql_close();
echo "<META HTTP-EQUIV=REFRESH CONTENT='1; URL=pollsele.php?id=$id'>"; }
?>
----------------------------------------------------------------------
pollsee.php //投票结果
<? if ($toupiao!=""){
$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select Pollsele_Name,pollsele_num from pollsele where pollsele_name='$toupiao'";
@$result = mysql_query($sql);
$myrow=mysql_fetch_row($result);
$poll_num=$myrow[1];
$poll_num=$poll_num+1;
$sql="update pollsele set Pollsele_num='$poll_num' where pollsele_name='$toupiao'";
mysql_query($sql);
$sql="select Poll_Name from poll where poll_id='$poll_id'";
@$result = mysql_query($sql);
$title=mysql_fetch_row($result);
echo "<p align=center>";
echo $title[0]; echo "</p>";
echo "<br>";
$sql="select Pollsele_Name,pollsele_num from pollsele where pollsele_del='0' and pollsele_poll_id='$poll_id'";
@$result = mysql_query($sql);
echo "<table align=center bgcolor=aabbcc style='border:1px solid rgb(0,0,0)'>";
while($myrow=mysql_fetch_row($result))
{ echo "<tr>"; echo "<td width=150 bgcolor=99aabb style='border:1px solid rgb(255,255,255)'>";
echo $myrow[0];echo "</td><td width=50 bgcolor=99aabb style='border:1px solid rgb(255,255,255)'>";echo $myrow[1]; echo "</td></tr>";} echo "</table>"; }
else
{echo "<font color=red>你不能投空票!!!</font>";}
?>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
更新日志
2024年11月25日
2024年11月25日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]