本文实例讲述了PHP实现通过get方式识别用户发送邮件的方法。分享给大家供大家参考。具体如下:
send_email.PHP如下:
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 "";
echo "";
}
?>
reg.PHP如下:
PHP;">
PHP
$conn=MysqL_connect("localhost",$conn);
$sql="select * from comments";
$query=MysqL_query($sql);
while($out=MysqL_fetch_array($query))
{
echo $out["content"]."-------查看邮件
"; } ?>
"; } ?>
newfile.PHP如下:
PHP;">
PHP
$conn=MysqL_connect("localhost",$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"]."
"; echo $out["created_at"]."
"; echo "发送邮件
"; //看看有没有新邮件 $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 "
"; echo $out["created_at"]."
"; echo "发送邮件
"; //看看有没有新邮件 $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 "
您有新邮件
"; } ?>login.PHP如下:
PHP;">
清除session";
echo "重新注册";
?>
delete_session.PHP如下:
PHP;">
PHP
if(isset($_SESSION["id"]))
{
unset($_SESSION["id"]);
}
echo "";
?>
希望本文所述对大家的PHP程序设计有所帮助。
原文链接:https://www.f2er.com/php/21494.html