PHP implements the method of identifying users to send emails through get method, get sends emails_PHP tutorial

WBOY
Release: 2016-07-13 09:46:28
Original
630 people have browsed it

PHP implements the method of identifying users to send emails through the get method, and get sends emails

This article describes the example of PHP implementing the method of identifying users to send emails through the get method. Share it with everyone for your reference. The details are as follows:

send_email.php is as follows:

<&#63;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('&#63;&#63;&#63;&#63;&#63;&#63;&#63;&#63;&#63;');</script>";
    echo "<script>window.location.href='reg.php'</script>";
  }
&#63;>

Copy after login

reg.php is as follows:

<&#63;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&#63;id=".$out["id"]."'>查看邮件</a><br/>";
  }
&#63;>

Copy after login

newfile.php is as follows:

<&#63;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&#63;id=".$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&#63;id=".$result_email["id"]."'>您有新邮件</a></strong>";
}
&#63;>

Copy after login

login.php is as follows:

<&#63;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>";
&#63;>

Copy after login

delete_session.php is as follows:

<&#63;php
  if(isset($_SESSION["id"]))
  {
   unset($_SESSION["id"]);
  }
  echo "<script>alert('清除成功');</script>";
&#63;>

Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1033497.htmlTechArticlePHP implements the method of identifying users to send emails through the get method, and get sends emails. The example of this article describes the PHP implementation through the get method. Identifies the method used by the user to send mail. Share it with everyone for your reference...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template