澳门新浦京8455com一个php作的文本留言本的例子(一)

——————————-论坛————————– 数据表
create table guest(id int not null auto_increment,primary key(id),title
varchar(50),email varchar(30),homepage varchar(30),name varchar(30),text
text,relay int,r_time date) create table relay(id int not null
auto_increment,primarykey(id卡塔尔,title int,email varchar(30卡塔尔(قطر‎,name
varchar(30卡塔尔(قطر‎,text text卡塔尔————————-index.php————————–
STYLETD{FONT-FAMILY:小篆;FONT-SIZE:13pt}BODY{FONT-FAMILY:金鼎文;FONT-SIZE:13pt}SELECT{FONT-FAMILY:隶书;FONT-SIZE:13pt}A{COLOEscort:blue;FONT-FAMILY:行草;FONT-SIZE:13pt;TEXT-DECORATION:none}/STYLEdiv p font size=14b网址完全手册/font/p/div ?php $db
=mysql_connect(localhost, ****,****);
mysql_select_db(****,$db); @$result = mysql_query(SELECT * FROM
guest order by id desc,$db); $i=0; while($myrow =
mysql_fetch_row($result)) { $guestbook[$i][0] = $myrow[0];
$guestbook[$i][1] = $myrow[1]; $guestbook[$i][2] =
$myrow[2]; $guestbook[$i][3] = $myrow[4];
$guestbook[$i][4]=$myrow[6]; $guestbook[$i][5]=$myrow[澳门新浦京8455com,7];
$i++; }//读入数组 mysql_close($db) ; echo
—————————–共[; if ($q!=) { $page = $q; } else {
$page = 0; } $i=count($guestbook); $msgnum=20;// 每页20笔 $start = $page
* $msgnum; $end = $start + $msgnum; if ($end $i) $end=$i;
$totalpage=$i/$msgnum; for ($i=0; $i$totalpage; $i++) { if ($i!=$page) {
echo a href=index.php?q=$i $i/a; } else { echo $i; } } echo
]页—————————–br;printf(p align=righta
href=111.php增加大旨/a/p卡塔尔; echo br; echo table width=700 hight=560
border=1 ; echo tr;echo td width=200 bgcolor=aaaaaa border=1
style=border: 1px solid rgb(3,2,1卡塔尔大旨/td; echo td width=200
bgcolor=aaaaaa border=1 style=border: 1px solid rgb(3,2,1卡塔尔(قطر‎电子邮件/td;
echo td width=80 bgcolor=aaaaaa border=1 style=border: 1px solid
rgb(3,2,1State of Qatar呢称/td; echo td width=60 bgcolor=aaaaaa border=1
style=border: 1px solid rgb(3,2,1卡塔尔(قطر‎回复/td; echo td width=200
bgcolor=aaaaaa border=1 style=border: 1px solid
rgb(3,2,1卡塔尔(قطر‎最终回复时间/td; echo /tr; for ($i=$start; $i$end; $i++卡塔尔 {
$id=$guestbook[$i][0]; echo tr ;echo td width=200 bgcolor=bbbbbb
border=0 style=border: 1px solid rgb(3,2,1); echo a
href=444.php?id=$id;echo $guestbook[$i][1]; echo /a; echo /td; echo
td width=200 bgcolor=bbbbbb border=0 style=border: 1px solid rgb(3,2,1);
echo a href=mailto:.$guestbook[$i][2].;echo
$guestbook[$i][2];echo /a;echo /td; echo td width=80 bgcolor=bbbbbb
border=0 style=border: 1px solid rgb(3,2,1); echo $guestbook[$i][3];
echo /td; echo td width=60 bgcolor=bbbbbb border=0 style=border: 1px
solid rgb(3,2,1); echo $guestbook[$i][4]; echo /td; echo td
width=200 bgcolor=bbbbbb border=0 style=border: 1px solid rgb(3,2,1);
echo $guestbook[$i][5]; echo /td; echo /tr; } echo /table; echo br;
printf(a href=111.php增添宗旨/aState of Qatar; ?
——————————444.php——————————–
STYLETD{FONT-FAMILY:金鼎文;FONT-SIZE:13pt}BODY{FONT-FAMILY:草书;FONT-SIZE:13pt}SELECT{FONT-FAMILY:燕书;FONT-SIZE:13pt}A{COLOHighlander:blue;FONT-FAMILY:大篆;FONT-SIZE:13pt;TEXT-DECORATION:none}/STYLE
?php $db =mysql_connect(localhost, ****,****);
mysql_select_db(****,$db); @$result = mysql_query(SELECT * FROM
guest where id=’$id’,$db); echo table width=700 border=1 ; $myrow =
mysql_fetch_row($result); echo tr higth=20;echo td width=700
bgcolor=888888 border=1 style=border: 1px solid rgb(3,2,1)主题:; echo
$myrow[1]; echo /td; echo /tr; $msg=base64_decode($myrow[5]); $msg
= ereg_replace( ,,$msg卡塔尔(قطر‎;//空格管理 $msg=nl2br($msg卡塔尔(قطر‎;// 换行管理 if
($myrow[3]!=){$myrow[3]=a href=$myrow[3]$myrow[3]/a;} else
{$myrow[3]=小编还没有在英特网安家;} echo tr higth=60; echo td width=700
bgcolor=bbbbbb border=1 style=border: 1px solid rgb(3,2,1State of Qatar; echo
$msg;echo /td;echo /tr; echo tr higth=20;echo td width=700
bgcolor=bbbbee border=1 style=border: 1px solid rgb(3,2,1卡塔尔国主页:; echo
$myrow[3]; echo /td/tr; echo tr higth=20;echo td width=700
bgcolor=888888 border=1 style=border: 1px solid rgb(3,2,1卡塔尔;echo
回复列表; echo /td; echo /tr; $num=$myrow[6]; @$result1 =
mysql_query(SELECT * FROM relay where title=’$id’ order by id
desc,$db); $i=0; while($myrow1 = mysql_fetch_row($result1)) {
$guestbook[$i][0] = $myrow1[1]; $guestbook[$i][1] =
$myrow1[2]; $guestbook[$i][2] = $myrow1[3];
$guestbook[$i][3]=$myrow1[4]; $i++; } mysql_close($db); if ($q!=)
{ $page = $q; } else { $page = 0; } $i=count($guestbook); $msgnum=5;//
每页5笔 $start = $page * $msgnum; $end = $start + $msgnum; if ($end $i)
$end=$i; $totalpage=$i/$msgnum; for ($i=$start; $i$end; $i++) {
$t=$guestbook[$i][0]; echo tr ;echo td width=700 bgcolor=aaaaaa
border=0 style=border: 1px solid rgb(3,2,1); echo Re:; echo
$myrow[1];echo /td;echo /tr; echo tr ; echo td width=700
bgcolor=bbbbbb border=0 style=border: 1px solid rgb(3,2,1); echo
$guestbook[$i][2]; echo /td;echo /tr; echo tr ; echo td width=700
bgcolor=bbbbee border=0 style=border: 1px solid rgb(3,2,1卡塔尔(قطر‎电子邮件:;
echo a href=mailto:.$guestbook[$i][1].;echo
$guestbook[$i][1];echo /a;echo /td;echo /tr;
$msg=base64_decode($guestbook[$i][3]); $msg = ereg_replace(
,,$msg); $msg=nl2br($msg); echo tr ;echo td width=700 bgcolor=bbbbbb
border=0 style=border: 1px solid rgb(3,2,1); echo $msg; echo /td;echo
/tr; } echo /table; echo br; echo br;echo
——————————-共[; for ($i=0; $i$totalpage; $i++) { if
($i!=$page) { echo a href=444.php?q=$i&id=$id $i/a; } else { echo$i; }
}echo ]页———————————;echo br; echo a
href=333.php?t=$id&num=$num回复/a;echo br; echo a
href=index.php浏览宗旨/a; ?
——————————–333.php—————————–
html head ?php if (!$t){ if ($text==&$email==&$name==){echo *必填;echo
a
href=333.php?t=$title&name=$name&email=$email&text=$text&num=$num返回/a;
} else {if
(eregi(^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$,$email)){
$text = base64_encode($text卡塔尔;//考验邮件地址是不是合法 $db
=mysql_connect(localhost, ****,****); $time=date(y-m-d);
mysql_select_db(****,$db); $sql=insert into relay
values(”,’$title’,’$email’,’$name’,’$text’); $result =
mysql_query($sql); $num=$num+1; $sql=update guest set
relay=’$num’,r_time=’$time’ where id=’$title’;
$result=mysql_query($sql); mysql_close(卡塔尔(قطر‎; echo META HTTP-EQUIV=REFRESH
CONTENT=’1; U中华VL=444.php?id=$title’; } else {echo 邮件地址无效;echo a
href=333.php?t=$title&name=$name&text=$text&num=$num再次回到/a;} }} else
{?FORM ACTION=333.php METHOD=post table border=0 cellpadding=2 width=395
tr td width=百分之七十五input type=hidden name=title value=? echo $t; ?/td/tr tr
td nowrapfont color=004080吗称:*/font/td td width=10%input type=text
name=name size=10 value=? echo $name; ?/td /tr tr td nowrapfont
color=004080邮件:*/font/td td width=20%input type=text name=email
size=20 value=? echo $email; ?/td /tr tr td width=20%input type=hidden
name=num value=? echo $num; ?/td /tr tr td nowrapvalign=topfont
color=004080内容:*/font/td td width=80% colspan=3textarea rows=5
name=text cols=50 size=255? echo $text; ?/textarea/td /tr tr td
width=100% colspan=4 input type=submit value=送出 input type=reset
value=擦掉 /td /tr /table /FORM?} ? /head body /html
———————————– HTML HEAD ?php if
($title!=&$email!=&$name!=){ if
(eregi(^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$,$email)){
$text = base64_encode($textState of Qatar;//核查邮件地址是不是合法 $db
=mysql_connect(localhost, ****,****); $time=date(y-m-d);
mysql_select_db(****,$db); $sql=insert into guest
values(”,’$title’,’$email’,’$homepage’,’$name’,’$text’,”,’$time’);
$result = mysql_query($sql);mysql_close(State of Qatar; echo META
HTTP-EQUIV=REFRESH CONTENT=’1; USportageL=index.php’; } else { echo
邮件地址无效; echo a
href=111.php?title=$title&&homepage=$homepage&name=$name&text=$text重临/a;}}
else {echo *必填; echo a
href=111.php?title=$title&email=$email&homepage=$homepage&name=$name&text=$text返回/a;}
//mysql_close($dbState of Qatar //printf(留言成功a href=222.php按此重回/a卡塔尔国; ? /HEAD
BODY /BODY /HTML
——————————–111.php————————— html
head /head body FORM ACTION= METHOD=post table border=0 cellpadding=2
width=395 tr td nowrapfont color=004080题名:*/font/td td width=20%input
type=text name=title size=30 value=? echo $title; ?/td/trtr td
nowrapfont color=004080邮件:*/font/td td width=20%input type=text
name=email size=30 value=? echo $email; ?/td /tr tr td nowrapfont
color=004080主页:/font/td td width=25%input type=text name=homepage
size=30 value=? echo $homepage; ?/td /tr tr td nowrapfont
color=004080呢称:*/font/td td width=10%input type=text name=name
size=10 value=? echo $name; ?/td /tr tr td nowrapvalign=topfont
color=004080内容:/font/td td width=80% colspan=3textarea rows=5
name=text cols=50 size=255 ? echo $text; ?/textarea/td /tr tr td
width=100% colspan=4 input type=submit value=送出 input type=reset
value=擦掉 /td /tr /table /FORM /body /html

大家领略,数据库对于网络来讲的机要性.由于cgi的复杂,今后asp和php+mysql已经产生主流.大概具有的私房网页都要用到留言本,可是申请的留言本特不稳固.那为网络的沟通带来了繁多不便.所以,希望保有协调的留言本的爱侣尤为多.
不过,无偿的个人主页辅助asp和php的非常少.作者今后向你推荐奥索网,(卡塔尔帮忙php.那样您便有了能够具有和煦留言本的底蕴.今后,作者就经过二个文件留言本的事例来说述php的简便利用.
首先,我们先鲜明,留言的多少个经过:写留言,发送,查看.(找出State of Qatar等等.而且对于斑竹来讲,管理留言本又是必须的.那样大家就无妨定位于6个php文件,1个文件文件.6个php文件分别为:guest.php
manage.php reply.php sys.php del.php edit.php,1个公文文件为:guest.txt
先来探望guest.php的内容,你当然能够一贯将下边包车型地铁剧情放到您的php网页里,请保护笔者的难为,多谢.
———————- //guest.php:? require(sys.phpState of Qatar; if ($B1卡塔尔 {
if($message== or $name==State of Qatar { $errorm=font
color=red出错了!!!/font姓名和留言内容必填; } else { #写入数据 $space =
; $time = date(Y年m月d日H小时i分State of Qatar; $ip=$REMOTE_ADDR;
$name=encode($name); $homepage=encode($homepage); $from=encode($from);
$email=encode($email); $message=StripSlashes($message);
$message=htmlspecialchars($message);
$message=check_strlen_long($message); $message=nl2br($message);
$guestcontent = trtdfont
color=#AB00E1留言内容:/fontbr!–content$message!–endcontent ;
$guestcontent=$guestcontent.brfont
color=#6633FF留言人民代表大会名:/font!–name$name!–endname ; if ($email !=)
{$guestcontent=$guestcontent.brfont color=#9900CC电子信箱/fonta
href=/mailto:$email/!–email$email!–endemail/a.$space;} if ($homepage
!=) {$guestcontent=$guestcontent.font color=#9900CC主页:/font$hompagea
href=/$homepage/!–homepage$homepage!–endhomepage/a;}
$guestcontent=$guestcontent.brfont color=#0000FF时间:$time
来自:!–from$from!–endfrom $ip/font;
$guestcontent=ereg_replace(chr(10),,$guestcontent);
$guestcontent=$guestcontent.hr size=1/td/tr/n; $fp=fopen($guestfile,a);
fputs($fp,$guestcontent); fclose($fp); } } ? html head
titlezihanonlinegbook/title style !– A:link {text-decoration: none ;
color:0000ff} A:visited {text-decoration: none; color:004080} A:active
{text-decoration: none} A:hover {text-decoration: underline;
color:ff0000} BODY {FONT-SIZE:10pt} TH {FONT-SIZE:10 pt} TD {FONT-SIZE:
10pt} TEXTAREA { FONT-FAMILY: 宋体; FONT-SIZE: 10pt; } — /style body
bgcolor=#FFFFFD background=bg.jpg div align=center?
include(‘head.htm’);? table width=68% border=1 cellpadding=3
cellspacing=0 bordercolor=#E3E3E3 form method=POST action=guest.php ?
if ($errorm) { echo tr; echo td colspan=3 height=32 ; echo $errorm; echo
/td; echo /tr; } ?trtd width=22% bgcolor=#F0F0F0font
color=#000000姓名font color=#FF0033(必填)/font/font/td td colspan=2
width=78% bgcolor=#F0F0F0font color=#00FF00input type=text name=name
size=40 /font/td /tr trtd width=22% height=29主页:/td td colspan=2
height=29 width=78%input type=text name=homepage size=40 value= /td /tr
trtd width=22% height=27 bgcolor=#F0F0F0来自:/td td colspan=2 height=27
width=78% bgcolor=#F0F0F0input type=text name=from size=40 /td /tr trtd
width=22% height=20Email:/td td colspan=2 height=20 width=78%font
color=#00FF00input type=text name=email size=40 /font/td /tr trtd
colspan=3 valign=middle align=leftdiv align=centerfont
color=#000000请留言/fontfont color=#FF0033(必填)/fontfont
color=#00FF00br textarea rows=6 name=message cols=55
wrap=VIRTUAL/textarea /font/div /td /tr tr bgcolor=#F0F0F0td colspan=3
height=24div align=centerfont color=#00FF00input type=submit value=发送
name=B1 input type=reset value=重 写 name=B2 /font/div /td /tr /form
/table table width=68% border=1 cellpadding=4 cellspacing=0
bordercolor=#E3E3E3 trtd table width=百分百 border=0 cellpadding=0
cellspacing=0 form action=manage.php method=post trtd colspan=2input
type=hidden name=dispflag value=show 管理密码:inputtype=password
name=password size=8 input type=submit value=分明 name=submit /td /tr
/form /table /td td table width=百分百 border=0 cellpadding=0
cellspacing=0 form action=guest.php method=post trtd 请输加入关贸总协定组织键字:input
type=text name=keyword size=10 input type=submit name=search
value=寻找留言 /td /tr /form /table /td /tr /table ? function
search($keyword卡塔尔 { global $content; $count=count($content卡塔尔(قطر‎;
$subscript=0; $ArrSearch=array(卡塔尔国; for ($i=0;$i$count;$i++卡塔尔 { if
(ereg($keyword,$content[$i])){
$ArrSearch[$subscript]=ereg_replace($keyword,font
color=red$keyword/font,$content[$i]); $subscript++; } } return
$ArrSearch; }//end function $one_page_line=15; $content =
file($guestfile); if (isset($search) and isset($keyword) and $keyword!=)
{ $content=search($keyword); } $count =count($content); ? table
width=68% border=0 tr td ? $int_page_count=$count;//总条数;
$int_page_num=ceil($int_page_count/$one_page_line);//总页数; echo
font color=#CC33FF分页:; for ($i=1;$i=$int_page_num;$i++) { echo a
href=guest.php?page=$i.$i./a; } echo /font; if (isset($search) and
isset($keyword) and $keyword!=State of Qatar { echo brcenter; echo
上边包车型地铁留言中包蕴关键字font color=red$keyword/font共font
color=red.$count./font条/center; } ? /tdtdp align=right共有font
color=red?echo $count?/font条/p/td /tr /table /div br table width=68%
border=0 align=center ? if ($page== or !isset($page)) {$page=1;} $text=;
$begin_line=$int_page_count-($page-1)*$one_page_line; if
($begin_line$one_page_line){$one_page_line=$begin_line;} for
($j=$begin_line;$j($begin_line-$one_page_line);$j–) {
$text=$text.trtd align=right colspan=2a
href=reply.php?job=reply&record=.$j.回复/aa
href=edit.php?record=.$j.编辑/aa href=dele.php?record=.$j.删除/a第font
color=red$j/font条/td/tr; $text.=$content[$j-1]; //数组找下标从0早先.
} echo $text; ? /table ? include(‘bottom.htm’卡塔尔; ? /body/html
—————— 未完待续…

投票处理程序

表结构
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>”;}

    ?>  

【本文版权归小编与奥索网协同拥有,如需转发,请声明我及出处】    

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图