模仿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 相关文章推荐
AMFPHP php远程调用(RPC, Remote Procedure Call)工具 快速入门教程
May 10 PHP
发一个php简单的伪原创程序,配合商城采集用的
Oct 12 PHP
PHP目录函数实现创建、读取目录教程实例
Jan 13 PHP
php设计模式 Template (模板模式)
Jun 26 PHP
PHP自动生成后台导航网址的最佳方法
Aug 27 PHP
如何让CI框架支持service层
Oct 29 PHP
php实现多城市切换特效
Aug 09 PHP
关于php中一些字符串总结
May 05 PHP
Yii+upload实现AJAX上传图片的方法
Jul 13 PHP
PHP 微信扫码支付源代码(推荐)
Nov 03 PHP
PHP 文件锁与进程锁的使用示例
Aug 07 PHP
PHP的PDO预处理语句与存储过程
Jan 27 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脚本的10个技巧(8)
2006/10/09 PHP
关于Appserv无法打开localhost问题的解决方法
2009/10/16 PHP
使用PHP导出Word文档的原理和实例
2013/10/21 PHP
PHP检查端口是否可以被绑定的方法示例
2018/08/09 PHP
JavaScript与DropDownList 区别分析
2010/01/01 Javascript
js 内存释放问题
2010/04/25 Javascript
NodeJS中Buffer模块详解
2015/01/07 NodeJs
js 获取元素在页面上的偏移量的方法汇总
2015/04/13 Javascript
jQuery获得指定元素坐标的方法
2015/04/14 Javascript
javascript实现可全选、反选及删除表格的方法
2015/05/15 Javascript
Webpack 实现 Node.js 代码热替换
2015/10/22 Javascript
如何解决手机浏览器页面点击不跳转浏览器双击放大网页
2016/07/01 Javascript
jQuery检查元素存在性(推荐)
2016/09/17 Javascript
使用JQuery选择HTML遍历函数的方法
2016/09/17 Javascript
微信小程序 解决请求服务器手机预览请求不到数据的方法
2017/01/04 Javascript
原生JavaScript实现的简单省市县三级联动功能示例
2017/05/27 Javascript
JS运动特效之任意值添加运动的方法分析
2018/01/24 Javascript
微信小程序单选框自定义赋值
2020/05/26 Javascript
Python随机生成手机号、数字的方法详解
2017/07/21 Python
Python正则表达式非贪婪、多行匹配功能示例
2017/08/08 Python
使用pandas实现csv/excel sheet互相转换的方法
2018/12/10 Python
Python pip替换为阿里源的方法步骤
2019/07/02 Python
python3.6+selenium实现操作Frame中的页面元素
2019/07/16 Python
Python scrapy增量爬取实例及实现过程解析
2019/12/24 Python
python GUI库图形界面开发之PyQt5打印控件QPrinter详细使用方法与实例
2020/02/28 Python
详解css3 object-fit属性
2018/07/27 HTML / CSS
Booking.com德国:预订最好的酒店和住宿
2020/02/16 全球购物
医学护理毕业生自荐信
2013/11/07 职场文书
应届毕业生求职信范文
2014/05/08 职场文书
村党支部公开承诺书
2014/05/29 职场文书
医药销售自荐书
2014/05/29 职场文书
管理标语大全
2014/06/24 职场文书
2015年机关纠风工作总结
2015/05/15 职场文书
春节晚会开场白
2015/05/29 职场文书
python3美化表格数据输出结果的实现代码
2021/04/14 Python
详解nodejs内置模块
2021/05/06 NodeJs