模仿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的一些小问题
Jul 03 PHP
如何在PHP中使用正则表达式进行查找替换
Jun 13 PHP
smarty模板中拼接字符串的方法
Feb 14 PHP
PHP开发框架kohana3 自定义路由设置示例
Jul 14 PHP
yii2中添加验证码的实现方法
Jan 09 PHP
php数组分页实现方法
Apr 30 PHP
CI框架入门之MVC简单示例
Nov 21 PHP
EarthLiveSharp中cloudinary的CDN图片缓存自动清理python脚本
Apr 04 PHP
php记录搜索引擎爬行记录的实现代码
Mar 02 PHP
php + WebUploader实现图片批量上传功能
May 06 PHP
PHP面向对象类型约束用法分析
Jun 12 PHP
Laravel第三方包报class not found的解决方法
Oct 13 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教程 基本语法
2009/10/23 PHP
php 文章采集正则代码
2009/12/28 PHP
PHP在不同页面间传递Json数据示例代码
2013/06/08 PHP
PHP变量的定义、可变变量、变量引用、销毁方法
2013/12/20 PHP
PHP获取数组中单列值的方法
2017/06/10 PHP
Laravel 框架返回状态拦截代码
2019/10/18 PHP
破除一些网站复制、右键限制
2006/11/04 Javascript
jquery 可排列的表实现代码
2009/11/13 Javascript
js 点击按钮弹出另一页,选择值后,返回到当前页
2010/05/26 Javascript
基于jQuery实现左右div自适应高度完全相同的代码
2012/08/09 Javascript
js 调用父窗口的具体实现代码
2013/07/15 Javascript
js定时器怎么写?就是在特定时间执行某段程序
2013/10/11 Javascript
jQuery图片拖动组件Dropzone用法示例
2017/01/17 Javascript
vue mixins组件复用的几种方式(小结)
2017/09/06 Javascript
Vue+penlayers实现多边形绘制及展示
2020/12/24 Vue.js
[04:30]显微镜下的DOTA2第五期——拉比克
2013/09/26 DOTA
python根据开头和结尾字符串获取中间字符串的方法
2015/03/26 Python
用Python的Django框架编写从Google Adsense中获得报表的应用
2015/04/17 Python
用python结合jieba和wordcloud实现词云效果
2017/09/05 Python
Python cookbook(数据结构与算法)根据字段将记录分组操作示例
2018/03/19 Python
python实现扫描日志关键字的示例
2018/04/28 Python
通过Pandas读取大文件的实例
2018/06/07 Python
Python面向对象程序设计之静态方法、类方法、属性方法原理与用法分析
2020/03/23 Python
Python爬虫Scrapy框架CrawlSpider原理及使用案例
2020/11/20 Python
Sunglasses Shop瑞典:欧洲领先的太阳镜网上商店
2018/04/22 全球购物
新西兰优惠网站:Treat Me
2019/07/04 全球购物
党支部创先争优活动总结
2014/08/28 职场文书
个人总结与自我评价
2014/09/18 职场文书
大学生党员自我剖析材料
2014/10/06 职场文书
个人专业技术总结
2015/03/05 职场文书
综合测评自我评价
2015/03/06 职场文书
2015年禁毒宣传活动总结
2015/03/25 职场文书
乡镇干部学习心得体会
2016/01/23 职场文书
基于Python实现对比Exce的工具
2022/04/07 Python
《王国之心》迎来了发售的20周年, 野村哲发布贺图
2022/04/11 其他游戏
Windows Server 2022 超融合部署(图文教程)
2022/06/25 Servers