The session Code of PHP
The code only uses the SID to determine whether to use a cookie or session
; The jump page cannot be a header if (Isset ($_post[sub))) { include conn.inc.php; $sql =select ID from the users where Name= ' {$_post[name]} ' and password= '. MD5 ($_post[password]). '; $result = $mysqli->query ($sql); Save Data if ($result->num_rows > 0) { $row = $result->fetch_assoc (); $_session[username]=$_post[name]; $_SESSION[UID]=$_POST[UID]; $_session[islogin5]=1; Jump interface echo '; } The Echo user name password is incorrect; }? >
<title></title>
conn.inc.php
comm.php
index.php
. $_session[username]. Hello! This is the homepage of the website; Echo session_id ().; echo you have the following permissions:; $sql =select allow_1,allow_2,allow_3,allow_4 from users where id= ' {$_session[uid]} '; $result = $mysqli->query ($sql); $user = $result->fetch_assoc (); if ($user [allow_1]) { echo 111111111111; } if ($user [allow_2]) { echo 222222222222; } if ($user [Allow_3]) { echo 333333333333; } if ($user [Allow_4]) { echo 444444444444; } ? > > Second page > third page > exit
Test.php and test2.php are written on the same page as index.php.
http://www.bkjia.com/PHPjc/971084.html www.bkjia.com true http://www.bkjia.com/PHPjc/971084.html techarticle PHP Session Code code only to determine the use of a cookie or session through the SID;//The Jump page cannot be a header if (Isset ($_post[sub])) {include conn.inc.php; $sql = Select ID from Users ...