注册 | 登录
收藏 | 帮助
热门文章
编辑推荐
相关文章  
走近 WSH(Windows Scripting Hos
从Melissa到Zotob:Windows蠕虫1
清除不明进程msser 珊瑚QQ病毒防
用Norton Internet Security拦截
Win2000 Server入侵监测揭秘
入侵NTserver典型途径攻击基础
简单三步走堵死SQLServer注入漏洞
安全配置Norton Security2004
提高本机安全从管理cookies开始
看清网站的身份证——SSL证书
您现在的位置: 顶尖设计 >> IT学院 >> 编程开发 >> PHP >> 文章正文
session全教程(二)
作者:佚名  来源:不详  点击:  更新:2006-12-19
简介:
* test.php 
* ------------------------------------------------------------------------ 
* PHP4 Customer Session Handler Test Script 
* Version 1.00 
* by Ying Zhang (ying@zippydesign.com) 
* Last Modified: May 21 2000 
*/ 

/* default to DBM handler */ 
if (! isset($handler)) { 
$handler = "dbm"; 

/* default action is increment */ 
if (! isset($action)) { 
$action = "increment"; 

/* load up the appropriate session handling script, depending on the handler */ 
if ($handler == "dbm") { 
include("session_dbm.php"); 

} elseif ($handler == "mysql") { 
include("session_mysql.php"); 

} else { 
echo "<li>Unrecognized handler ($handler)"; 
die; 

/* start the session and register a simple counter */ 
session_start(); 
session_register("count"); 

/* figure out what we should do, depending on the action */ 
switch ($action) { 
case "increment" : 
$count = isset($count) ? $count + 1 : 0; 
break; 

case "destroy" : 
session_destroy(); 
break; 

case "gc" : 
$maxlife = get_cfg_var("session.gc_maxlifetime"); 
sess_gc($maxlife); 
break; 

default: 
echo "<li>Unknown action ($action)"; 
break; 

?> 

<h1>Session Test Script</h1> 
<ul> 
<li>Handler: <b><?=$handler?></b> 
<li>Action: <b><?=$action?></b> 
<li>Count: <b><?=$count?></b> 
</ul> 

<hr size=1> 
<form> 
<table> 
<tr> 
<td>Handler:</td> 
<td> 
<select name="handler"> 
<option value="dbm">DBM</option> 
<option value="mysql">MySQL</option> 
</select> 
</td> 
</tr> 
<tr> 
<td>Action:</td> 
<td> 
<select name="action"> 
<option value="increment">Increment</option> 
<option value="destroy">Session Destroy</option> 
<option value="gc">Force Garbage Collection</option> 
</select> 
</td> 
</tr> 
<tr> 
<td></td> 
<td><br><input type="submit"></td> 
</tr> 
</table> 
</form> 
======================================================================= 

上一页  [1] [2] [3] 






  • 上一篇文章:
  • 下一篇文章:
  • 分享此文:该页面添加到 Mister Wong 添加到雅虎Yahoo!收藏 Add to:Del.icio.us Post to Furl Digg this 添加到Google书签 reddit spurl blogmarks 365Key 评论  收藏  分享  打印
     我来说两句
    姓名:       验证码:   
    主页: 
    评分: 1分 2分 3分 4分 5分
    本频道近期热评文章:
      关于我们 | 联系我们 | 站点地图 | 广告投放 | 友情链接 | 在线留言 | 版权申明
    版权所有 © 2004-2007 顶尖设计(bobd.cn)
    未经授权禁止转载,摘编,复制本站内容或建立镜像. 沪ICP备07504942号 
    网络110
    报警服务