模仿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取整函数:ceil,floor,round,intval的区别详细解析
Aug 31 PHP
PHP实现删除非站内外部链接实例代码
Jun 17 PHP
php使用pack处理二进制文件的方法
Jul 03 PHP
thinkPHP实现表单自动验证
Dec 24 PHP
php使用正则表达式获取图片url的方法
Jan 16 PHP
PHP验证信用卡卡号是否正确函数
May 27 PHP
thinkphp autoload 命名空间自定义 namespace
Jul 17 PHP
php实现的简单数据库操作Model类
Nov 16 PHP
php curl获取到json对象并转成数组array的方法
May 31 PHP
PHP5.5新特性之yield理解与用法实例分析
Jan 11 PHP
YII框架页面缓存操作示例
Apr 29 PHP
PHP 观察者模式深入理解与应用分析
Sep 25 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查找任何页面上的所有链接的方法
2013/12/03 PHP
基于ThinkPHP5.0实现图片上传插件
2017/09/25 PHP
workerman结合laravel开发在线聊天应用的示例代码
2018/10/30 PHP
让js弹出窗口居前显示的实现方法
2013/07/10 Javascript
JS幻灯片可循环播放可平滑旋转带滚动导航(自写)
2013/08/05 Javascript
jQuery的DOM操作之删除节点示例
2014/01/03 Javascript
一个奇葩的最短的 IE 版本判断JS脚本
2014/05/28 Javascript
14个有用的Jquery技巧分享
2015/01/08 Javascript
Jquery实现textarea根据文本内容自适应高度
2015/04/03 Javascript
js实现非常简单的焦点图切换特效实例
2015/05/07 Javascript
javascript中Date对象应用之简易日历实现
2016/07/12 Javascript
node.js中module.exports与exports用法上的区别
2016/09/02 Javascript
element-ui 表格实现单元格可编辑的示例
2018/02/26 Javascript
详解微信小程序scroll-view横向滚动的实践踩坑及隐藏其滚动条的实现
2019/03/14 Javascript
JavaScript鼠标拖拽事件详解
2020/04/03 Javascript
解决Antd 里面的select 选择框联动触发的问题
2020/10/24 Javascript
JavaScript canvas实现文字时钟
2021/01/10 Javascript
vue3.0 项目搭建和使用流程
2021/03/04 Vue.js
Python文件的读写和异常代码示例
2017/10/31 Python
Python进阶之递归函数的用法及其示例
2018/01/31 Python
python使用正则表达式来获取文件名的前缀方法
2018/10/21 Python
python对文件目录的操作方法实例总结
2019/06/24 Python
一文秒懂python读写csv xml json文件各种骚操作
2019/07/04 Python
django的auth认证,authenticate和装饰器功能详解
2019/07/25 Python
python利用re,bs4,requests模块获取股票数据
2019/07/29 Python
Python Merge函数原理及用法解析
2020/09/16 Python
Python实现小黑屋游戏的完整实例
2021/01/06 Python
解决selenium+Headless Chrome实现不弹出浏览器自动化登录的问题
2021/01/09 Python
手机端用rem+scss做适配的详解
2017/11/15 HTML / CSS
linux面试题参考答案(9)
2016/01/29 面试题
研讨会主持词
2014/04/02 职场文书
住院医师规范化培训实施方案
2014/06/12 职场文书
领导班子四风问题对照检查材料
2014/09/27 职场文书
奶茶店的创业计划书该怎么写?
2019/07/15 职场文书
演讲稿之开卷有益
2019/08/07 职场文书
MySQL Shell的介绍以及安装
2021/04/24 MySQL