DDR爱好者之家 Design By 杰米

本文实例讲述了PHP实现通过get方式识别用户发送邮件的方法。分享给大家供大家参考。具体如下:

send_email.php如下:

<"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('";
    echo "<script>window.location.href='reg.php'</script>";
  }
"htmlcode">
<"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".$out["id"]."'>查看邮件</a><br/>";
  }
"htmlcode">
<"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".$out["id"]."'>发送邮件</a><br/><hr>";
//看看有没有新邮件
$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".$result_email["id"]."'>您有新邮件</a></strong>";
}
"htmlcode">
<"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>";
"htmlcode">
<"id"]))
  {
   unset($_SESSION["id"]);
  }
  echo "<script>alert('清除成功');</script>";
?>

希望本文所述对大家的php程序设计有所帮助。

DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米