Example program: TEST_SESSION.PHP3
Require ("cookie.inc.php3");
?>
Session_checkid (20); Session expires in 20 minutes.
Below you need to set the MySQL connection parameters
mysql_connect (' localhost ', ' user ', ' pass ') or Die ("can ' t connect to db!");
?>
<title>session/cookie-Test</title>
This page should show how to handle the "SESSION.INC.PHP3" library
We'll use a mask with a record showing routine
if ($show) {
if (Session_read ()) {
$username = $session [username];
$userpass = $session [Userpass];
echo "
Session[username]: $username
Session[userpass]: $userpass ";
}
}
else{
$session [username]= "Yourid";
$session [userpass]= "12345";
if (!session_write ()) {
Print $sess _error;
}else{
echo "
Session[username] is set to: $session [username]
" ;
echo "Session[userpass" is set to: $session [Userpass]
" ;
echo "Test the function of the session";
}
}
?>
Original Author: unknown
http://www.bkjia.com/PHPjc/316697.html www.bkjia.com true http://www.bkjia.com/PHPjc/316697.html techarticle Example program: test_session.php3 php require (SESSION.INC.PHP3); require (COOKIE.INC.PHP3);?? PHP Session_checkid (20); After 20 minutes the session expires//Below you need to set up MySQL connection ...