PHP实现通过get方式识别用户发送邮件的方法
网络编程 2021-07-05 09:09www.168986.cn编程入门
这篇文章主要介绍了PHP实现通过get方式识别用户发送邮件的方法,涉及php针对数据库的读取、判断及session登陆的使用技巧,需要的朋友可以参考下
本文实例讲述了PHP实现通过get方式识别用户发送邮件的方法。分享给大家供大家参考。具体如下:
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,aepter_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 ments"; $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 ments 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"]."'>发送邮件</a><br/><hr>"; //看看有没有新邮件 $sql_search_email="select * from email where aepter_id='".$id."'"; $query=mysql_query($sql_search_email); $result_email=mysql_fetch_array($query); if($result_email["aepter_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'>重新注册</a>"; ?>
delete_session.php如下:
<?php if(isset($_SESSION["id"])) { unset($_SESSION["id"]); } echo "<script>alert('清除成功');</script>"; ?>
希望本文所述对大家的php程序设计有所帮助。
编程语言
- 机械手焊接机器人编程 机械手焊接设备编程
- vb数据库编程实例,vb做数据库
- tiobe世界编程语言排行榜,全球编程语言排行
- 成都java编程培训 成都it编程培训中心
- 编程基础培训,编程基础知识培训
- flash游戏编程基础教程,flash游戏开发教程
- 不会英语能学编程吗 不会英语可以学程序员吗
- 爱心代码编程C语言 爱心代码编程c语言公式
- c语言编程学习入门 c语言编程快速入门
- 西门子plc编程培训 西门子plc编程培训班
- 哪里可以学编程 台州哪里可以学编程
- 少儿编程哪个好 少儿编程哪个品牌好
- 编程是什么意思,图形编程是什么意思
- c语言编程软件下载,c语言编程软件在哪下载
- java编程软件下载,java编程下载手机版
- ug编程培训学校,ug编程培训教程