|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我先解释一下我的学习思路。 暗码查询:class/querypsw.php
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>扣问暗码</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<?php
include "config.php";
//扣问班级注册成绩暗码
if ($class){
$headers .= "Content-Type: text/html; charset=gb2312n"; // Mime type
$subject="扣问班级注册成绩暗码 "; //主题
$message=nl2br($message);
$message="查询人:".$name."<BR>留言:<BR>".$message; //内容
mail($superemail,$subject,$message,$headers);
echo "祝贺您,您的恳求已向办理员收回,近期内请注重查收email。";
exit;
}
//扣问团体注册暗码
if ($member){
$result = mysql_query("SELECT * FROM user where user='$username'",$db);
if (mysql_num_rows($result)==0){ //若前往列的数量为0,申明无此材料
echo "咱们的数据库中无此用户,请确认。注重巨细写。<a href='javascript:history.back()'>前往</a>";
exit;}
$myemail=mysql_result($result,0,"email");//读取user数据库中的email
if (!$myemail){ //假如还没有email,则前往
echo "咱们的数据库中没有您的email,请再次填写。<a href='javascript:history.back()'>前往</a>";
exit;
}
$psw=mysql_result($result,0,"psw"); //暗码
$name=mysql_result($result,0,"name"); //姓名
$subject="扣问团体注册暗码";
$message=$name.",您好。您的用户名是".$username.",暗码是".$psw."。<BR>-----------------------<BR><a href='".$url."'>".$sitename."</a>"; //函件内容
$headers .= "Content-Type: text/html; charset=gb2312n"; // Mime type
mail($myemail,$subject,$message,$headers);
echo "祝贺您,体系已向您的信箱中收回了回答函件,请注重查收email。";
exit;
}
?>
<table width="93%" border="0" cellspacing="0" cellpadding="0" align="center" height="286">
<tr>
<td height="75" colspan="2">
<div align="center">扣问暗码<br>
</div>
</td>
</tr>
<tr>
<td height="75" width="47%">
<form name="form1" method="post" action="<? echo $PHP_SELF;?>"><div align="center">扣问班级注册成绩谜底<br>
您的姓名
<input type="text" name="name">
<br>您的留言(写上能证明您身份的冗长留言及email地址)
<textarea name="message" rows="3" cols="50"></textarea>
<br>
体系将向班级办理员发送您的恳求,是不是确认?<br>
<input type="submit" name="class" value="确认">
<input type="reset" name="cancel" value="重填">
<br>
</div></form>
</td>
<td height="75" width="53%">
<div align="center">
<form name="form2" method="post" action="<? echo $PHP_SELF;?>">
扣问团体注册暗码<br>
<br>
您的用户名(不是姓名)<br>
<br>
<input type="text" name="username">
<br>
<br>
<br>
体系将会向您注册的信箱中发发送暗码,是不是确认?<br>
<input type="submit" name="member" value="确认">
<input type="reset" name="cancel2" value="重填">
</form>
</div>
</td>
</tr>
</table>
</BODY>
</HTML>
悄然话:privatenote.php
<?
session_start(); // 入手下手session
if(!session_is_registered("userregister")||($userregister==""))//反省是不是注册,如userregister未注册或session为空值,从头注册.
{
echo "<a href='../index.php'>请从头注册<BR>";
exit;
}
//删除留言
include "config.php";
if ($del=="1"){
mysql_query("delete from privatenote where id='$id'",$db); //以id为删除标记
echo "删除胜利!";
}
//添加留言
if ($Submit){
$id=time(); //以工夫戳为纪录号
$time=date("Y年m月d日 h:i:s A");//留言工夫
$result = mysql_query("SELECT * FROM user where user='$userregister'",$db);
$fromuser=mysql_result($result,0,'name'); //发动静人姓名
$result = mysql_query("SELECT * FROM user where name='$yname'",$db);
$touser=mysql_result($result,0,'user'); ; //承受人用户名
$message=nl2br(strip_tags($ynote));//留言内容
mysql_query("INSERT INTO privatenote (id,fromuser,touser,time,message) values ('$id','$fromuser','$touser','$time','$message')",$db); //写入数据库
echo "留言胜利!";
}
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>悄然话</TITLE>
<style type="text/CSS">
<!--
.blue9 { font-size: 10pt; color: #9999FF; text-decoration: none}
.black10 { font-size: 10pt}
-->
</style>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<table width="64%" border="1" cellspacing="1" cellpadding="1" align="center" ">
<tr>
<td colspan="2" height="63">
<div align="center"><img src="http://edu.cnzz.cn/NewsInfo/image/classlogo.gif" width="224" height="60">
</div>
</td>
</tr>
<tr>
<td class="blue9" colspan="2">
<div align="center">
<?
$result = mysql_query("SELECT * FROM user where user='$userregister'",$db);
$name=mysql_result($result,0,"name");//姓名
echo $name;
?>
的悄然话</div>
</td>
</tr>
<tr>
<td class="blue9" colspan="2">
<?php
$result = mysql_query("SELECT * FROM privatenote where touser='$userregister' ORDER BY time DESC",$db);
$row=mysql_num_rows($result); //悄然话总数
$unlook=0;
if (!$row==0){
for ($i=0;$i<$row;$i++){
$id=mysql_result($result,$i,'id');//留言id
$fromuser=mysql_result($result,$i,'fromuser');//留言人姓名
$time=mysql_result($result,$i,'time'); //留言工夫
$message=mysql_result($result,$i,'message'); //留言内容
$look_s="已看过"; //正文
$look=mysql_result($result,$i,'look'); //是不是看过
if ($look=="0"){$unlook++;$look_s="还没有看过";} //盘算未看过的悄然话数量,并改动正文
mysql_query("UPDATE privatenote SET look='1' where id='$id'",$db); //将悄然话看过形态改成1
echo "第",$i+1,"条 收回人:",$fromuser," 留言工夫:",$time,"<BR>";
echo " 留言内容:",$message,"<BR>------",$look_s;
echo "<a href='$PHP_SELF?del=1&id=$id'>删除</a><HR>";
}
}
echo "悄然话总数:",$row,".",$unlook,"条新悄然话.";
?>
</td>
</tr>
<tr>
<td class="black10" colspan="2">
<form method="post" action="<?php echo $PHP_SELF;?>">
<p align="center">您要给谁发悄然话?
<select name="yname">
<?
$result = mysql_query("SELECT * FROM user",$db);
$row=mysql_num_rows($result); //成员人数
for ($i=0;$i<=($row-1);$i++){
$name=mysql_result($result,$i,'name'); //姓名
echo "<option>",$name,"</option>";
}
mysql_close($db);
?>
</select>
<br>
留言内容:<br>
<textarea name="ynote" cols="60" rows="6"></textarea>
<br>
<b>
<input type="submit" name="Submit" value="确认">
</b>
<input type="reset" name="cancel" value="重写">
</p>
</form>
</td>
</tr>
</table>
</BODY>
</HTML>
我的文章不会对您的学习起到实质性的作用,您能否成功,还得靠自己的,坚持,坚持,再坚持,就是步入成功的不二法门。 |
|