最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

PHP實(shí)現(xiàn)通過get方式識(shí)別用戶發(fā)送郵件的方法

 更新時(shí)間:2015年07月16日 09:44:20   作者:宋勇野  
這篇文章主要介紹了PHP實(shí)現(xiàn)通過get方式識(shí)別用戶發(fā)送郵件的方法,涉及php針對(duì)數(shù)據(jù)庫的讀取、判斷及session登陸的使用技巧,需要的朋友可以參考下

本文實(shí)例講述了PHP實(shí)現(xiàn)通過get方式識(shí)別用戶發(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>";
//看看有沒有新郵件
$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)文章

最新評(píng)論

新兴县| 乐安县| 双峰县| 涞源县| 肥东县| 肇东市| 房产| 保亭| 仁怀市| 商都县| 汕头市| 册亨县| 神木县| 五峰| 巴林右旗| 年辖:市辖区| 双柏县| 东乌珠穆沁旗| 苗栗县| 西藏| 平邑县| 时尚| 类乌齐县| 巴里| 昭苏县| 潮安县| 平潭县| 南城县| 吉木乃县| 苏尼特右旗| 固始县| 浮山县| 南涧| 安龙县| 扎兰屯市| 桂平市| 灌南县| 和龙市| 苏尼特右旗| 恭城| 北碚区|