|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
php manual(PHP手册)肯定是要从网上下载一个的,它很权威,也很全面,我自己认为它是一本很好的参考书,但是不适合新手当教材使用。 repal.php答复用的页面,由于答复可以不用如果用户,所以没加用户身份校验
<html>
<head>
<title>答复论题:<? echo $zt;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/CSS>
P {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt}
DIV {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt}
</STYLE>
<LINK href="js/cpcw.css" rel=stylesheet /LINK>
<?php
include "linkfox.inc.php"; //包括进文件
include "info.inc.php";
function yy($f)
{
$oldmess=@file($f); //援用原文处置
for ($i=0;$i<count($oldmess);$i++)
{
if (ord(substr($oldmess[$i],0,1))==161) //第一名是不是全角空格
$mess=$mess.$oldmess[$i];
else $mess=$mess." ".trim($oldmess[$i]);
}
return $mess;
}
function mesput($query,$use,$id)
{
$req=mysql_query($query);
if ($req)
{
echo "<script language='JavaScript'> alert('感谢你的答复!体系将前往论题!'); </script>";
echo "<script language='JavaScript'> javascript:location.href='dispbbs.php?id=".$id."&use=".$use."'; </script>;";
echo "<div align='center'><a href='dispbbs.php?id=".$id."&use=".$use."'>假如体系没有反响,请点击</a></a>";
}
else
echo "<script language='JavaScript'> alert('写入掉败!'); </script>";
}
function usehf($message,$useinfo,$id,$use,$ft,$mess,$c) //用户答复就直接从内外调出用户信息
{
$query="select * from useinfo where usename='".$useinfo[0]."'";
$req=mysql_query($query);
if ($req)
{
$useinfo=mysql_fetch_array($req);
$fo=fopen($ft,"a");
$message=str_replace("<","<",str_replace(">",">",$message));
$message=nl2br($message);
$gip=getenv("REMOTE_ADDR");
$messages=$message."ㄞㄚㄓ".$useinfo[2]."ㄞㄚㄓ".$useinfo[3]."ㄞㄚㄓ".$useinfo[9]."ㄞㄚㄓ".$useinfo[8]."ㄞㄚㄓ".$useinfo[14]."ㄞㄚㄓ".$useinfo[11]."ㄞㄚㄓ".$time."ㄞㄚㄓ".$gip."δεζ";
if($c==dd) //假如是援用答复,加上原文内容
{
$messages="<font color='999999'>".$mess."<div align='center'>★原文……★……援用★</div></font><br>".$messages;
}
$fp=fputs($fo,$messages);
$time=date(Y年n月j日G时i分); //主题答复数加一,掩盖上一答复人与工夫
$query="update foxbbs set hfnum=hfnum+1,hfname='".$ft."',hfusename='".$useinfo[2]."',hfdate='".$time."' where id='".$id."'";
mesput($query,$use,$id);
}
else
{
echo "<script language='JavaScript'> alert('数据库毛病:104号'); </script>";
}
}
function gr($ft,$message,$youname,$youmail,$youoicq,$youweb,$youaddr,$youbq,$id,$use,$mess,$c) //非注册用户
{
if (!uinfo($youmail,mail)||strlen($youmail)<12) //校验MAIL
{
echo "<script language='JavaScript'> alert('请输出准确的MAIL地址!'); </script>";
}
else if (!uinfo($youoicq,oicq)||strlen($youoicq)>12) //校验OICQ,只能判别是不是数字和位数,假如有更好的办法就好。
{
echo "<script language='JavaScript'> alert('请输出准确的OICQ号!'); </script>";
}
else
{
if (uinfo($youweb,web)==OK&&substr($youweb,0,3)!=htt) $youweb="http://".$youweb;
else if (uinfo($youweb,web)==OK&&substr($youweb,0,3)==htt) $youweb=$youweb;
else $youweb="不告知你";
$time=date(Y年n月j日G时i分); //取以后工夫
$message=str_replace("<","<",str_replace(">",">",$message));
$message=nl2br($message);
$gip=getenv("REMOTE_ADDR");
$messages=$message."ㄞㄚㄓ".$youname."ㄞㄚㄓ".$youoicq."ㄞㄚㄓ".$youweb."ㄞㄚㄓ".$youmail."ㄞㄚㄓ".$youbq."ㄞㄚㄓ".$youaddr."ㄞㄚㄓ".$time."ㄞㄚㄓ".$gip."δεζ";
if($c==dd) //假如是援用答复
{
$messages="<font color='999999'>".$mess."<div align='center'>★原文……★……援用★</div></font><br>".$messages;
}
$fo=fopen($ft,"a");
$fp=fputs($fo,$messages);
$query="update foxbbs set hfnum=hfnum+1,hfname='".$ft."',hfusename='".$youname."',hfdate='".$time."' where id='".$id."'";
mesput($query,$use,$id);
}
}
?>
</head>
<body bgcolor="#FFFFFF">
<?
$tem=$HTTP_COOKIE_VARS[FlyFoxNet];
$temp=explode("|",$tem);
$cookiem=$temp[0];
$useinfo=cuser($cookiem,$action);
if (!$useinfo[0]){ $useinfo[2]="旅客"; $usename=1;}
$query="select mesname from foxbbs where id='".$id."'";
$req=mysql_query($query);
if ($req)
{
$f=mysql_fetch_array($req);
$mess=yy($f[0]);
if ($message&&$action=add)
{
$ft="foxbbs/".$f[0].".bbs";
if (ord(substr($message,0,1))!=161) $message=" ".$message;
for ($i=0;$i<10;$i++)
{
if ($bq[$i]) $youbq=$bq[$i];
}
if ($usename) gr($ft,$message,$youname,$youmail,$youoicq,$youweb,$youaddr,$youbq,$id,$use,$mess,$c);
else usehf($message,$useinfo,$id,$use,$ft,$mess,$c);
}
}
else echo "<script language='JavaScript'> alert('翻开文件毛病!能够办事器忙,请稍候再试!'); </script>";
?>
<table width="100%" cellpadding="4" cellspacing="0" border="0">
<tr>
<td height="20">
<div align="right"></div>
</td>
<td height="20" width="75"> </td>
<td height="20" width="75"> </td>
<td height="20" width="75"> </td>
<td height="20" width="75"> </td>
</tr>
<tr>
<td height="20">
<div align="right"></div>
</td>
<td height="20" width="10%">
<div align="center"><a href="reguse.php?action=xy"><img src="http://edu.cnzz.cn/NewsInfo/images/top_register.gif" width="74" height="21" border="0"></a></div>
</td>
<td height="20" width="10%">
<div align="center"><a href="useinfo.php?action=find"><img src="http://edu.cnzz.cn/NewsInfo/images/top_members.gif" width="74" height="21" border="0"></a></div>
</td>
<td height="20" width="10%"><a href="useinfo.php?action=edit"><img src="http://edu.cnzz.cn/NewsInfo/images/top_profile.gif" width="74" height="21" border="0"></a></td>
<td height="20" width="10%"><a href="okey.php?d=q"><img src="http://edu.cnzz.cn/NewsInfo/images/top_logout.gif" width="74" height="21" border="0"></a></td>
</tr>
<tr>
<td height="20">
<div align="left">以后地位:<font color="#0000FF">狐网─>狐网服装论坛─>答复主题:<?echo "<font color='ff0000'>".$zt."</font>";?></font></div>
</td>
<td> <div align="center"><a href="foxbbs.php"><img src="http://edu.cnzz.cn/NewsInfo/images/index.gif" width="70" height="20" border="0" align="middle"></a></div>
</td>
<td height="20" width="10%">
<div align="center"><a href="superuse.php"><img src="http://edu.cnzz.cn/NewsInfo/images/super.gif" width="70" height="20" border="0" align="middle"></a></div>
</td>
<td height="20" width="10%">
<div align="center"><a href="reguse.php?action=xy"><img src="http://edu.cnzz.cn/NewsInfo/images/dl.gif" width="70" height="20" border="0" align="middle"></a></div>
</td>
<td height="20" width="10%">
<div align="center"><a href="../index.php"><img src="http://edu.cnzz.cn/NewsInfo/images/fox.gif" width="70" height="20" border="0" align="middle"></a></div>
</td> </tr>
</table>
<script language="JavaScript">
<!--
var submitcount=0;
function checkSubmit() {
if (submitcount == 0) {
submitcount++;
return true;
} else {
if (submitcount>0){
alert("帖子已胜利提交了,别急,等等!");
return false;
}
}
}
function check_com(){
if(document.form.youname.value.length ==0){
submitcount--;
alert("名字不克不及为空!快填上吧!");
return false;
}
if(document.form.youmail.value.length ==0){
submitcount--;
alert("EMAIL不克不及为空!快填上吧!");
return false;
}
if(document.form.youoicq.value.length ==0){
submitcount--;
alert("OICQ不克不及为空!快填上吧!");
return false;
}
if(document.form.message.value.length == 0){
submitcount--;
alert("内容不克不及为空!");
return false;
}
return true;
}
//-->
</script>
<table width='70%' border='0' cellspacing='0' cellpadding='0' bgcolor='#000000' align='center'>
<tr>
<td>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr bgcolor='#006699'>
<td><div align="center"><font color="ffffff"><? echo "<font color='00ff00'>".$useinfo[2]."</font>"; ?> 你正在答复的主题是:[<? echo $zt; ?>]</font></div></td>
</tr>
<tr bgcolor='#eeeeee'>
<td>
<form name="form" method="post"><div align="center">
<?
if ($usename) //不是注册用户就显示输出框输出旅客信息。
{
echo "你的台甫:<input ".$youname."'>";
echo "OICQ:<input ".$youoicq."'><br>";
echo "来自何方:<input ".$youaddr."'><br>";
echo "电子信箱:<input ".$youmail."'><br>";
echo "团体主页:<input ".$youweb."'><br>";
echo "脸色<br><input type='radio' name='bq[0]' value='a'><img src='http://edu.cnzz.cn/NewsInfo/images/a.gif'><input type='radio' name='bq[1]' value='1'><img src='http://edu.cnzz.cn/NewsInfo/images/1.gif'>";
echo "<input type='radio' name='bq[2]' value='2'><img src='http://edu.cnzz.cn/NewsInfo/images/2.gif'><input type='radio' name='bq[3]' value='3'><img src='http://edu.cnzz.cn/NewsInfo/images/3.gif'>";
echo "<input type='radio' name='bq[4]' value='4'><img src='http://edu.cnzz.cn/NewsInfo/images/4.gif'><input type='radio' name='bq[5]' value='5'><img src='http://edu.cnzz.cn/NewsInfo/images/5.gif'>";
echo "<input type='radio' name='bq[6]' value='6'><img src='http://edu.cnzz.cn/NewsInfo/images/6.gif'><input type='radio' name='bq[7]' value='7'><img src='http://edu.cnzz.cn/NewsInfo/images/7.gif'>";
echo "<input type='radio' name='bq[8]' value='8'><img src='http://edu.cnzz.cn/NewsInfo/images/8.gif'><input type='radio' name='bq[9]' value='9'><img src='http://edu.cnzz.cn/NewsInfo/images/9.gif'><br>";
}
echo "<div align='center'>答复内容<br>";
echo "<textarea >".$message."</textarea><br>";
?>
<input type="submit" name="Submit" value="肯定" >
<input type="reset" name="Submit2" value="重写"></div></div></form>
</td>
</tr>
<tr bgcolor='#eeeeee'>//假如是援用原文就显示
<td><div align="center"><? if ($c==dd) echo "原文以下<br><div align='left'>".$mess;?></div></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html> 把例子全部敲进去试验,完成一遍以后就会有心得了,因为你会发现为啥我的程序和书上的一模一样就是结果不正确。新手学习的时候必须承认,不容易,因为我也是过来人,你会发现原来有那么多常用的语句,函数都要记。 |
|