<script type="text/javascript">
</script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<?PHP require( "SESSION.inc.PHP3");
require("cookie.inc.PHP3");
?>
<?PHP
SESSION_checkid( 20 ); //20分钟后SESSION失效
//下面你需要设置mysql的连接参数
mysql_connect(’localhost’,’user’,’pass’) or Die("can’t connect to db!");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>SESSION/Cookie-测试</title>
</head>
<body>
<h2>This Page should show how to handle the "SESSION.inc.PHP3" library</h2>
<h3>We will use a mask with a record showing routine</h3>
<?PHP
if( $show ) {
if( SESSION_read() ) {
$username = $SESSION[username];
$userpass = $SESSION[userpass];
echo "<P>SESSION[username]:$username
SESSION[userpass]:$userpass";
}
}
else{
$SESSION[username]="yourid";
$SESSION[userpass]="12345";
if( !SESSION_write() ) {
print $sess_error;
}else{
echo "<p>SESSION[username]被设置成:$SESSION[username]
" ;
echo "SESSION[userpass]被设置成:$SESSION[userpass]
" ;
echo "<a href=’$PATH_INFO?show=1’>测试一下SESSION的作用</a>" ;
}
}
?>
</body>
</html>
<script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript">
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
示例程序:test_SESSION.PHP3 <?PHP require( "SESSION.inc.PHP3");
require("cookie.inc.PHP3");
?>
<?PHP
SESSION_checkid( 20 ); //20分钟后SESSION失效
//下面你需要设置mysql的连接参数
mysql_connect(’localhost’,’user’,’pass’) or Die("can’t connect to db!");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>SESSION/Cookie-测试</title>
</head>
<body>
<h2>This Page should show how to handle the "SESSION.inc.PHP3" library</h2>
<h3>We will use a mask with a record showing routine</h3>
<?PHP
if( $show ) {
if( SESSION_read() ) {
$username = $SESSION[username];
$userpass = $SESSION[userpass];
echo "<P>SESSION[username]:$username
SESSION[userpass]:$userpass";
}
}
else{
$SESSION[username]="yourid";
$SESSION[userpass]="12345";
if( !SESSION_write() ) {
print $sess_error;
}else{
echo "<p>SESSION[username]被设置成:$SESSION[username]
" ;
echo "SESSION[userpass]被设置成:$SESSION[userpass]
" ;
echo "<a href=’$PATH_INFO?show=1’>测试一下SESSION的作用</a>" ;
}
}
?>
</body>
</html>
<script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript">
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>