PHP實(shí)現(xiàn)通過(guò)get方式識(shí)別用戶(hù)發(fā)送郵件的方法
本文實(shí)例講述了PHP實(shí)現(xiàn)通過(guò)get方式識(shí)別用戶(hù)發(fā)送郵件的方法。分享給大家供大家參考。具體如下:
send_email.php如下:
<?php $conn=mysql_connect("localhost","root","admin"); mysql_select_db("songyunb_development",$conn); $id=$_GET["id"]; $sql="insert into email (sender_id,accepter_id,flag) values ('".$_SESSION["id"]."','".$id."','no')"; $query=mysql_query($sql); if($query) { echo "<script>alert('?????????');</script>"; echo "<script>window.location.href='reg.php'</script>"; } ?>
reg.php如下:
<?php $conn=mysql_connect("localhost","root","admin"); mysql_select_db("songyunb_development",$conn); $sql="select * from comments"; $query=mysql_query($sql); while($out=mysql_fetch_array($query)) { echo $out["content"]."-------<a href='newfile.php?id=".$out["id"]."'>查看郵件</a><br/>"; } ?>
newfile.php如下:
<?php $conn=mysql_connect("localhost","root","admin"); mysql_select_db("songyunb_development",$conn); $result=""; $id=""; if(isset($_GET["id"])) { $id=$_GET["id"]; $sql="select * from comments where id='".$_GET["id"]."'"; $result=mysql_query($sql); } $out=mysql_fetch_array($result); echo $out["content"]."<br/>"; echo $out["created_at"]."<br/>"; echo "<a href='send_email.php?id=".$out["id"]."'>發(fā)送郵件</a><br/><hr>"; //看看有沒(méi)有新郵件 $sql_search_email="select * from email where accepter_id='".$id."'"; $query=mysql_query($sql_search_email); $result_email=mysql_fetch_array($query); if($result_email["accepter_id"]==$_SESSION["id"]&&$result_email["flag"]=="no") { echo "<strong><a href='see_email.php?id=".$result_email["id"]."'>您有新郵件</a></strong>"; } ?>
login.php如下:
<?php $conn=mysql_connect("localhost","root","admin"); mysql_select_db("songyunb_development",$conn); $_SESSION["id"]=15; echo "<a href='delete_session.php'>清除session</a>"; echo "<a href='reg.php'>重新注冊(cè)</a>"; ?>
delete_session.php如下:
<?php if(isset($_SESSION["id"])) { unset($_SESSION["id"]); } echo "<script>alert('清除成功');</script>"; ?>
希望本文所述對(duì)大家的php程序設(shè)計(jì)有所幫助。
相關(guān)文章
學(xué)習(xí)php設(shè)計(jì)模式 php實(shí)現(xiàn)模板方法模式
這篇文章主要介紹了php設(shè)計(jì)模式中的模板方法模式,使用php實(shí)現(xiàn)模板方法模式,感興趣的小伙伴們可以參考一下2015-12-12PHP+Mysql+jQuery實(shí)現(xiàn)動(dòng)態(tài)展示信息
在本文中,我將介紹如何在頁(yè)面上實(shí)現(xiàn)動(dòng)態(tài)展示用戶(hù)發(fā)表的信息,將用戶(hù)發(fā)表的信息逐條播放展示。該效果可以在展示系統(tǒng)動(dòng)態(tài)、商品評(píng)論等場(chǎng)景應(yīng)用2011-10-10PHP下操作Linux消息隊(duì)列完成進(jìn)程間通信的方法
當(dāng)我們開(kāi)發(fā)的系統(tǒng)需要使用多進(jìn)程方式運(yùn)行時(shí),進(jìn)程間通信便成了至關(guān)重要的環(huán)節(jié)。消息隊(duì)列(message queue)是Linux系統(tǒng)進(jìn)程間通信的一種方式。2010-07-07PHP關(guān)于htmlspecialchars、strip_tags、addslashes的解釋
這篇文章主要介紹了PHP關(guān)于htmlspecialchars、strip_tags、addslashes的解釋,需要的朋友可以參考下2014-07-07PHP基于timestamp和nonce實(shí)現(xiàn)的防止重放攻擊方案分析
這篇文章主要介紹了PHP基于timestamp和nonce實(shí)現(xiàn)的防止重放攻擊方案,簡(jiǎn)單講述了重放攻擊相關(guān)原理并結(jié)合實(shí)例形式分析了php使用timestamp和nonce實(shí)現(xiàn)的防止重放攻擊相關(guān)操作技巧,需要的朋友可以參考下2019-07-07