杏林同學(xué)錄(五)_PHP教程
Jul 21, 2016 pm 04:04 PM
密碼查詢:class/querypsw.php
include "config.php";
//詢問(wèn)班級(jí)注冊(cè)問(wèn)題密碼
if ($class){
$headers .= "Content-Type: text/html; charset=gb2312n"; // Mime type
$subject="詢問(wèn)班級(jí)注冊(cè)問(wèn)題密碼 "; //主題
$message=nl2br($message);
$message="查詢?nèi)耍?.$name."
留言:
".$message;?????//內(nèi)容
???mail($superemail,$subject,$message,$headers);
???echo "恭喜您,您的請(qǐng)求已經(jīng)向管理員發(fā)出,近期內(nèi)請(qǐng)注意查收email。";
???exit;
??}
??//詢問(wèn)個(gè)人注冊(cè)密碼
??if ($member){??
??$result = mysql_query("SELECT * FROM user where user='$username'",$db);
??if (mysql_num_rows($result)==0){??//若返回列的數(shù)目為0,說(shuō)明無(wú)此資料
echo "我們的數(shù)據(jù)庫(kù)中無(wú)此用戶,請(qǐng)確認(rèn)。注意大小寫(xiě)。返回";
exit;}
???$myemail=mysql_result($result,0,"email");//讀取user數(shù)據(jù)庫(kù)中的email
????if (!$myemail){?????????????????????????//如果還沒(méi)有email,則返回
?????echo "我們的數(shù)據(jù)庫(kù)中沒(méi)有您的email,請(qǐng)?jiān)俅翁顚?xiě)。返回";
?????exit;
????}
$psw=mysql_result($result,0,"psw");??????//密碼
$name=mysql_result($result,0,"name");????//姓名
$subject="詢問(wèn)個(gè)人注冊(cè)密碼";
$message=$name.",您好。您的用戶名是".$username.",密碼是".$psw."。
-----------------------
".$sitename."";??????//信件內(nèi)容
$headers .= "Content-Type: text/html; charset=gb2312n"; // Mime type
mail($myemail,$subject,$message,$headers);
???echo "恭喜您,系統(tǒng)已經(jīng)向您的信箱中發(fā)出了答復(fù)信件,請(qǐng)注意查收email。";
???exit;
??}
?>??
?? ?????????? 詢問(wèn)密碼 ?????????? ???????? | |
?????????? ???????? | ?????????? ???????? ???????? ???????? |
悄悄話:privatenote.php
session_start(); // 開(kāi)始session
if(!session_is_registered("userregister")||($userregister==""))//檢查是否注冊(cè),如userregister未注冊(cè)或session為空值,重新注冊(cè).
{
echo "請(qǐng)重新注冊(cè)
";
exit;
}
//刪除留言
include "config.php";
if ($del=="1"){
mysql_query("delete from privatenote where id='$id'",$db); //以id為刪除標(biāo)志
echo "刪除成功!";
}
//添加留言
if ($Submit){
$id=time();?????????????????????//以時(shí)間戳為記錄號(hào)
$time=date("Y年m月d日 h:i:s A");//留言時(shí)間
$result = mysql_query("SELECT * FROM user where user='$userregister'",$db);
$fromuser=mysql_result($result,0,'name');???????????????????????//發(fā)消息人姓名
$result = mysql_query("SELECT * FROM user where name='$yname'",$db);
$touser=mysql_result($result,0,'user'); ;??????????//接受人用戶名
$message=nl2br(strip_tags($ynote));//留言內(nèi)容
mysql_query("INSERT INTO privatenote (id,fromuser,touser,time,message) values ('$id','$fromuser','$touser','$time','$message')",$db); //寫(xiě)入數(shù)據(jù)庫(kù)
echo "留言成功!";
}
?>
?? ?????? ![]() ?????? ???? | |
?? ?????? ?????? $result = mysql_query("SELECT * FROM user where user='$userregister'",$db); $name=mysql_result($result,0,"name");//姓名 echo $name; ?> ??????的悄悄話 ???? ?? ?? | |
if (!$row==0){ ??????????????for ($i=0;$i????/留言id ???????????????$fromuser=mysql_result($result,$i,'fromuser');//?,'time');????????//留言時(shí)間 ???????????????$message=mysql_result($result,$i,'message');??//???????????????????????????//註解 ???????i,'look');????????//是否看過(guò) ????????????????if ($look=="0"){$unlook ;$look_s="尚未看過(guò)的語(yǔ)言計(jì)算 //數(shù)位未看過(guò)的字?jǐn)?shù)}改變?cè)]解 ???????????????mysql_query("UPDATE privatenote SET look='1' where id='$id'?????????echo "第",$i 1 ,"條發(fā)出人:",$fromuser," 留言時(shí)間:",$time," "; ???????????????echo " 留言內(nèi)容:",$message," ------" ------" ,$look_s; ???????????????echo " |