About the use of the PHP Message Board feature implementation

Source: Internet
Author: User
This article mainly for you to introduce the PHP implementation of the message board function, session control cases, with a certain reference value, interested in small partners can refer to

This example for everyone to share the PHP message board function of the specific code for your reference, the specific content as follows

Three tables used in the database

I. Login interface (denglu.php login.php)

1.denglu.php

<! DOCTYPE html>

2.login.php

<?phpsession_start (); $UserName = $_post["UserName"; $PassWord = $_post["PassWord"];require "DBDA.class1.php"; $db = new Dbda (); $sql = "Select PassWord from yuangong where UserName = ' {$UserName} '"; $arr = $db->query ($sql); if (Count ($ar R) {  if ($arr [0][0] = = $PassWord &&!empty ($PassWord))  {    //store user name    $_session["UserName"] = $ UserName;        Header ("location:main.php");}  } else{  Header ("location:denglu.php");}

Two. Main interface (main.php tuichu.php)

1.main.php

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

2.tuichu.php

<?phpsession_start (); Unset ($_session["UserName"]); Header ("location:denglu.php");

Three. Send page (fabu.php fabuchuli.php)

1.fabu.php

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

2.fabuchuli.php

<?phpsession_start (); $UserName = $_session["UserName"); $JSR = $_post["JSR"]; $nr = $_post["Neirong"]; $Times = Date (" y-m-d h:i:s "); require" DBDA.class.php "; $db = new Dbda (); $sql =" INSERT into Liuyan values (', ' {$UserName} ', ' {$JSR} ', ' {$ Times} ', ' {$NR} '); $db->query ($sql, 0); Header ("location:fabu.php");

The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.