模仿OSO的论坛(三)
程序员文章站
2022-05-14 12:11:06
post.php(发新贴子) 疑难问题
post.php(发新贴子)
<html><head><title>疑难问题</title>
<link href="mypic/style.css" rel=stylesheet type=text/css></head>
<?php
if (!$cookie_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='".$cookie_user."' and password='".$cookie_password."'";
$res = mysql_query($query);
if (!$res)
{echo "<script language='javascript'>";
echo "parent.location.href='index.php'";
echo "</script>";}
include "connect.inc.php";
if ($theme) {$content=htmlspecialchars($content);
$content=nl2br($content);
$theme=htmlspecialchars($theme);
$theme=nl2br($theme);
$query = "insert into guestbook (name,type,theme,content,icon,time_open,time_close,answer_count,answer_name) values ('".$cookie_user."',1,'".$theme."','".$content."',".$icon.",now(),now(),1,'".$cookie_user."')";
$res = mysql_query($query);
if ($res)
{echo "<script language='javascript'>";
echo "parent.location.href='post_end.php'";
echo "</script>";}
else echo $query;}}
?>
<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">
<table border=0 cellpadding=0 cellspacing=0 width="100%" class=body_br>
<tbody>
<script language=javascript
src="mypic/x.js"></script>
<tr>
<td valign=top>
<form action=post.php?forum_id=11 method=post name=form
onsubmit="return check_com()">
<table align=center border=0 cellpadding=4 cellspacing=0 width=100%>
<tbody>
<tr>
<td class=mid width=20%>主 题</td>
<td><input maxlength=30 name=theme size=50> </td>
<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>加贴内容</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>
</tbody></table></form></td></tr>
</tbody></table>
</form>
</html>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
<html><head><title>疑难问题</title>
<link href="mypic/style.css" rel=stylesheet type=text/css></head>
<?php
if (!$cookie_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='".$cookie_user."' and password='".$cookie_password."'";
$res = mysql_query($query);
if (!$res)
{echo "<script language='javascript'>";
echo "parent.location.href='index.php'";
echo "</script>";}
include "connect.inc.php";
if ($theme) {$content=htmlspecialchars($content);
$content=nl2br($content);
$theme=htmlspecialchars($theme);
$theme=nl2br($theme);
$query = "insert into guestbook (name,type,theme,content,icon,time_open,time_close,answer_count,answer_name) values ('".$cookie_user."',1,'".$theme."','".$content."',".$icon.",now(),now(),1,'".$cookie_user."')";
$res = mysql_query($query);
if ($res)
{echo "<script language='javascript'>";
echo "parent.location.href='post_end.php'";
echo "</script>";}
else echo $query;}}
?>
<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">
<table border=0 cellpadding=0 cellspacing=0 width="100%" class=body_br>
<tbody>
<script language=javascript
src="mypic/x.js"></script>
<tr>
<td valign=top>
<form action=post.php?forum_id=11 method=post name=form
onsubmit="return check_com()">
<table align=center border=0 cellpadding=4 cellspacing=0 width=100%>
<tbody>
<tr>
<td class=mid width=20%>主 题</td>
<td><input maxlength=30 name=theme size=50> </td>
<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>加贴内容</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>
</tbody></table></form></td></tr>
</tbody></table>
</form>
</html>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】