模仿OSO的论坛(四)


Posted in PHP onOctober 09, 2006

reply.php(用来回复主题)
<HTML><HEAD><TITLE>疑难问题</TITLE>
<LINK href="mypic/style.css" rel=STYLESHEET type=text/css></HEAD>
<?php
if (!$cook_user)
{echo "<script language='javascript'>";  
echo "parent.location.href='index.php'";  
echo "</script>";}
else {include ("connect.inc.php");
$query = "select * from my_user where user='".$cook_user."' and password='".$cook_password."'";  
$res = mysql_query($query);  
if (!$res)
{echo "<script language='javascript'>";  
echo "parent.location.href='index.php'";  
echo "</script>";}
include "connect.inc.php";
if ($content) {$content= str_replace ( "'","mysinglequotes",$content);  
$content=htmlspecialchars($content);
$content=nl2br($content);
$query = "INSERT INTO guestbook (name,type,content,icon,time_open,time_close,answer_count,answer_name,main_id) VALUES ('".$cook_user."',0,'".$content."',".$icon.",now(),now(),1,'".$cook_user."',".$theme_id.")";  
$res = mysql_query($query);
if ($res)  
{$query = "update guestbook set time_close=now(),answer_count=answer_count+1,answer_name='".$cook_user."' where id=".$theme_id;  
$res = mysql_query($query);  
if ($res)
{echo "<script language='javascript'>";  
echo "parent.location.href='post_end.php'";
echo "</script>";}}}}
?>
<SCRIPT language=JavaScript>
<!--
var submitcount=0;
function check_com(){
   if(document.form.theme.value.length ==0){
      submitcount--;
      alert("主题不能为空!nYou must supply a subject.");
      return false;
   }

   if(document.form.content.value.length == 0){
      submitcount--;
      alert("加贴内容不能为空!nYou must supply a message.");
      return false;
   }
   return true;
}
//-->
</SCRIPT>
<BODY bgColor=#cccc99 bottomMargin=0 leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<form method="post" action="reply.php" name="form" onSubmit="return check_com()">
<SCRIPT language=JavaScript  
src="mypic/x.js"></SCRIPT>
  <TR>
    <TD vAlign=top>
      <TABLE align=center border=0 cellPadding=4 cellSpacing=0 width=100%>
        <TBODY>
        <TR>
          <TD class=mid width=20%>回复主题<BR><BR></TD>
          <TD class=mid><A class=title  
            href="read.php?theme_id=<?php echo $theme_id ?>">
<?php  
$query = "select theme from guestbook where id=".$theme_id;
$res = mysql_query($query);  
$row = mysql_fetch_row($res);  
echo $row[0];
?>
</A><BR><BR></TD></TR>
        <TR>
          <TD class=mid vAlign=top>表情图标</TD>
          <TD><INPUT CHECKED name=icon type=radio value=1> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon1.gif"  
            width=18><INPUT name=icon type=radio value=2> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon2.gif"  
            width=18><INPUT name=icon type=radio value=3> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon3.gif"  
            width=18><INPUT name=icon type=radio value=4> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon4.gif"  
            width=18><INPUT name=icon type=radio value=5> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon5.gif"  
            width=18><INPUT name=icon type=radio value=6> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon6.gif"  
            width=18><INPUT name=icon type=radio value=7> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon7.gif"  
            width=18><BR><INPUT name=icon type=radio value=8> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon8.gif"  
            width=18><INPUT name=icon type=radio value=9> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon9.gif"  
            width=18><INPUT name=icon type=radio value=10> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon10.gif"  
            width=18><INPUT name=icon type=radio value=11> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon11.gif"  
            width=18><INPUT name=icon type=radio value=12> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon12.gif"  
            width=18><INPUT name=icon type=radio value=13> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon13.gif"  
            width=18><INPUT name=icon type=radio value=14> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon14.gif"  
            width=18></TD></TR>
        <TR>
          <TD class=mid vAlign=top><input type="hidden" name="theme_id" size="12" class="stedit" value="<?php echo $theme_id ?>">
          加贴内容</TD>
          <TD><TEXTAREA cols=50 name=content rows=6></TEXTAREA> </TD></TR>
        <TR>
          <TD> </TD>
          <TD><INPUT name=submit onclick="return checkSubmit()" type=submit value=" 发 表 ">  
                   <INPUT name=reset type=reset value=" 清 除 "> </TD></TR>
               </FORM>
        <TR>
          <TD colSpan=2><BR><BR><FONT color=#797979>
            <LI>本主题最后 5 个帖子 (按发帖时间倒序排列)</FONT></LI></TD></TR></TBODY></TABLE>
      <TABLE align=center bgColor=#000000 border=0 cellPadding=4 cellSpacing=1  
      width=100%>
        <TBODY>
        <TR bgColor=#666666>
          <TD width="10%"><FONT color=#ffffff>作 者</FONT></TD>
          <TD width="90%"><FONT color=#ffffff>内 容</FONT></TD></TR>
<?php
$query = "select * from guestbook where main_id=".$theme_id." or id=".$theme_id." order by time_open DESC limit 5 ";
$res = mysql_query($query);  
function TdBackColor() {
  static $ColorStr;
  if ($ColorStr=="#ededed") {
    $ColorStr="#dedede";
  } else {
    $ColorStr="#ededed";
  }
  return($ColorStr);
}
for ($i=1;$i<=5;$i++)
{$row = @mysql_fetch_array($res);  
if (!$row) break;  
$ColorStr=TdBackColor();
echo "<TR bgColor=".$ColorStr.">";
echo "<TD vAlign=top>".$row['name']."</td>";  
$content= str_replace ( "mysinglequotes","'",$row['content']);  
echo "<td>".$content."</td></tr>";  
}
?>      
</TBODY></TABLE>
</TBODY></TABLE>
</FORM>
</html>  

【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】    

PHP 相关文章推荐
PHP程序61条面向对象分析设计的经验小结
Nov 12 PHP
PHP 抓取网页图片并且另存为的实现代码
Mar 24 PHP
PHP字符串函数系列之nl2br(),在字符串中的每个新行 (\n) 之前插入 HTML 换行符br
Nov 10 PHP
探讨:parse url解析URL,返回其组成部分
Jun 14 PHP
PHP获取浏览器信息类和客户端地理位置的2个方法
Apr 24 PHP
php类的定义与继承用法实例
Jul 07 PHP
Symfony2实现从数据库获取数据的方法小结
Mar 18 PHP
php文件类型MIME对照表(比较全)
Oct 07 PHP
PHP闭包定义与使用简单示例
Apr 13 PHP
实例讲解php将字符串输出到HTML
Jan 27 PHP
Yii框架参数配置文件params用法实例分析
Sep 11 PHP
php面试实现反射注入的详细方法
Sep 30 PHP
二十行语句实现从Excel到mysql的转化
Oct 09 #PHP
一个颜色轮换的简单例子
Oct 09 #PHP
让你的PHP同时支持GIF、png、JPEG
Oct 09 #PHP
定制404错误页面,并发信给管理员的程序
Oct 09 #PHP
php录入页面中动态从数据库中提取数据的实现
Oct 09 #PHP
使用字符串函数输出整数化的PHP版本号
Oct 09 #PHP
树型结构列出指定目录里所有文件的PHP类
Oct 09 #PHP
You might like
PHP新手上路(二)
2006/10/09 PHP
解决phpmyadmin 乱码,支持gb2312和utf-8
2006/11/20 PHP
php SQL防注入代码集合
2008/04/25 PHP
php之Smarty模板使用方法示例详解
2014/07/08 PHP
PHP常用算法和数据结构示例(必看篇)
2017/03/15 PHP
Yii2框架可逆加密简单实现方法
2017/08/25 PHP
PHP封装的XML简单操作类完整实例
2017/11/13 PHP
PHP常用日期加减计算方法实例小结
2018/07/31 PHP
动态添加js事件实现代码
2009/03/12 Javascript
在IE上直接编辑网页内容的js代码(IE地址栏js)
2009/04/27 Javascript
js模拟类继承小例子
2010/07/17 Javascript
JavaScript中操作Mysql数据库实例
2015/04/02 Javascript
jquery Validation表单验证使用详解
2020/09/12 Javascript
bootstrap-treeview自定义双击事件实现方法
2016/01/09 Javascript
jquery对Json的各种遍历方法总结(必看篇)
2016/09/29 Javascript
js数字舍入误差以及解决方法(必看篇)
2017/02/28 Javascript
tab栏切换原理
2017/03/22 Javascript
JavaScript实现移动端轮播效果
2017/06/06 Javascript
python获取文件版本信息、公司名和产品名的方法
2014/10/05 Python
利用numpy+matplotlib绘图的基本操作教程
2017/05/03 Python
Django中间件实现拦截器的方法
2018/06/01 Python
Python读取指定日期邮件的实例
2019/02/01 Python
django配置连接数据库及原生sql语句的使用方法
2019/03/03 Python
详解用Python进行时间序列预测的7种方法
2020/03/13 Python
Python模块zipfile原理及使用方法详解
2020/08/04 Python
python openssl模块安装及用法
2020/12/06 Python
使用Python获取爱奇艺电视剧弹幕数据的示例代码
2021/01/12 Python
HTML5 移动页面自适应手机屏幕四类方法总结
2017/08/17 HTML / CSS
总经理职责
2013/12/22 职场文书
学生请假条
2014/04/11 职场文书
体育活动总结范文
2014/05/04 职场文书
承诺书模板
2014/08/30 职场文书
2015年打非治违工作总结
2015/04/02 职场文书
Spring-cloud Config Server的3种配置方式
2021/09/25 Java/Android
68行Python代码实现带难度升级的贪吃蛇
2022/01/18 Python
Java对文件的读写操作方法
2022/04/29 Java/Android