As a message board, let's take a look at the files in the picture below to refer to those.
Global.php is a global file that has data link code. index.php is the display file does not need to say the following have explained, login.php login file, logout.php exit login, madd.php add message, mreplay.php reply message, OK, let's take a look at the code for the global.php file first.
<?php
@header ("content-type:text/html; Charset=utf-8 ");
$dbhost = ' localhost ';//Database server
$dbuser = ' root ';//database user name
$dbpwd = ';//Database Password
$dbname = ' DEMO_GB ';//Database name
$db =mysql_connect ($dbhost, $dbuser, $dbpwd) or Die (') to connect to the database. ');
mysql_select_db ($dbname, $db) or Die (' cannot connect to the database. ');
mysql_query ("Set names ' UTF8 '");
?>
This is all database connection functions Oh.
Now see logout.php here to remove the Sesson OK. The code is as follows.
<?php
@header ("content-type:text/html; Charset=utf-8 ");
session_start ();
if (Session_destroy ())
{
echo ("Out ok!");
//window.alert (' Exit succeeded! ')
die ("<script>;window.location.href= ' index.php ';</script>");
}
else echo "Out false" and "Go Back";
//header ("location:index2.php");
?