PHP implements a Get method to identify how a user sends a message, and a get sends a message
The example in this paper describes how PHP implements a Get method to identify a user sending a message. Share to everyone for your reference. Specific as follows:
send_email.php as follows:
<?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 as follows:
<?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]." -------View Messages
"; }? >
newfile.php as follows:
<?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"]. "
"; Echo $out [" Created_at "]."
"; echo" Send mail
"///See if there is a new mail $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 " you have new mail ";}? >
login.php as follows:
<?php$conn=mysql_connect ("localhost", "root", "admin"); mysql_select_db ("Songyunb_development", $conn); $_session["id"]=15; echo "Clear session"; echo "Re-registration";? >
delete_session.php as follows:
<?php if (isset ($_session["id")) { unset ($_session["id"]); } echo "";? >
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1033497.html www.bkjia.com true http://www.bkjia.com/PHPjc/1033497.html techarticle PHP implementation by get method to identify the user to send messages, get send mail This article describes the PHP implementation of the way to identify the user to send mail. Share for everyone to join us ...