易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : php

httpOnly cookie flag support in PHP 5.2

http://ilia.ws/archives/121-httpOnly-cookie-flag-support-in-PHP-5.2.html
Thanks to a patch from Scott
MacVicar that I've just applied to CVS, PHP 5.2 will have support for
httpOnly cookie flag. This neat little feature allows you to mark a
newly created cookie as HTTP only, another words inaccessible to
browser based scripting languages such as JavaScript. This means it
would become far more difficult, if not impossible to steal a user's
cookie based session by injecting JavaScript into a page and then using
to read cookies.
This flag can be toggled by passing TRUE as the 7th parameter to the
setcookie() and the setrawcookie() functions respectively. Ex:
PHP:
<?
php
setcookie
(
"abc"

"test"

NULL

NULL

NULL

NULL

TRUE
); 
setrawcookie
(
"abc"

"test"

NULL

NULL

NULL

NULL

TRUE
); 
?>
The support ......

php 負載均衡

Submitted by gouki
on 2008, December 28, 9:00 PM. PHP


文章的内容写的不错,所以转载一下。
原文:http://xinsync.xju.edu.cn/index.php/archives/2946
内容如下:
XML/HTML代码
过去当运行一个大的web应用时候意味着运行一个大型的web服务器。因为你的应用吸引了大量的用户,你将不得不在你的服务器里增加更多的内存和处理器。  
  
今天,’大型服务器’模式已经过去,取而代之的是大量的小服务器,使用各种各样的负载均衡技术。这是一种更可行的方法,将使硬件成本降至最低。  
  
‘更多小服务器’的优势超过过去的’大型服务器’模式体现在两个方面:  
  
   1. 如果服务器宕机,那么负载均衡系统将停止请求到宕机的服务器,转而分发负载到其他正常运行的服务器上。  
   2. 扩展你的服务器更加容易。你要做的仅仅是加入新的服务器到负载均衡系统。不需要中断你的应用运行。  
  
所以,把握住这个机会:). 当然,代价就是这要求你的应用开发时增加一点复杂度。这 ......

php配置文件解析 深未来

PHP]
;;;;;;;;;;;
; WARNING ;
;;;;;;;;;;;
; This is the default settings file for new PHPinstallations.
; By default, PHP installs itself with a configuration suitablefor
; development purposes, and *NOT* for production purposes.
; For several security-oriented considerations that should betaken
; before going online with your site, please consultphp.ini-recommended
; and http://php.net/manual/en/security.php.
;;;;;;;;;;;;;;;;;;;
; About php.ini   ;
;;;;;;;;;;;;;;;;;;;
; This file controls many aspects of PHP'sbehavior.  In order for PHP to
; read it, it must be named 'php.ini'.  PHP looksfor it in the current
; working directory, in the path designated by the environmentvariable
; PHPRC, and in the path that was defined in compile time (in thatorder).
; Under Windows, the compile-time path is the Windowsdirectory.  The
; path in which the php.ini file is looked for can be overriddenusing
; the -c argument in command line mode.
;
; The synta ......

常用PHP函数

这是一些使用频率比较高的函数,有的来自别人的程序......
1.产生随机字符串函数
function random($length) {
 $hash = '';
 $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
 $max = strlen($chars) - 1;
 mt_srand((double)microtime() * 1000000);
 for($i = 0; $i < $length; $i++) {
  $hash .= $chars[mt_rand(0, $max)];
 }
 return $hash;
}
2.截取一定长度的字符串
注:该函数对GB2312使用有效
function wordscut($string, $length ,$sss=0) {
 if(strlen($string) > $length) {
               if($sss){
                      $length=$length - 3;
                      $addstr=' ...';
          & ......

php 中$_SESSION的理解

       PHP有很多值得学习的地方,这里我们主要介绍PHP Session使用。在PHP开发中对比起Cookie,session 是存储在服务器端的会话,相对安全,并且不像 Cookie 那样有存储长度限制,下面我们就简单介绍 PHP Session使用。
 
  由于 Session 是以文本文件形式存储在服务器端的,所以不怕客户端修改 Session 内容。
实际上在服务器端的 Session 文件,PHP 自动修改 session 文件的权限,只保留了系统读和写权限,而且不能通过 ftp 修改,所以安全得多。PHPChina 开源社区门户对于 Cookie 来说,假设我们要验证用户是否登陆,就必须在 Cookie 中保存用户名和密码(可能是 md5 加密后字符串),并在每次请求页面的时候进行验证。如果用户名和密码存储在数据库,每次都要执行一次数据库查询,给数据库造成多余的负担。
  因为我们并不能只做一次验证。为什么呢?因为客户端 Cookie 中的信息是有可能被修改的。假如你存储 $admin 变量来表示用户是否登陆,$admin 为 true 的时候表示登陆,为 false 的时候表示未登录,在第一次通过验证后将 $admin 等于 true 存储在 Cookie,下次就不用验证了,这样对么?错了,假如有人伪造一个值为 true 的 ......

PHP Session 两种不同存储方式

转自:http://www.cmsgp.org/article/3.html PHP Session使我们能够将用户的数据保存在服务器端。但是Session数据是临时的,并且通常当用户关闭浏览器时,保存Session id的Cookie就会被删除,相关的Session数据也将因此丢失。当然,我们可以通过修改session.cookie_lifetime这个参数来控制Cookie有效时间。
PHP Session在默认情况下是保存在文件中的(与参数session.save_handler相关)。参数session.save_path定义了session文件的路径。这些session文件会被php垃圾收集器删除。所以,如果要保存一些永久性数据,我们需要把它们保存在数据库中。
Session文件存储
在默认情况下,Session是保存在文件里的。我们可以通过设置session.save_path来指定session文件的路径。为了能够使 session临时文件保存更长的时间,我们可以设置相关参数session.gc_probability, session.gc_divisor和session.gc_maxlifetime。这三个参数控制了php垃圾收集器的激活频率和Session最大有效时间。例如:
session.gc_probability = 100
session.gc_divisor = 100
session.gc_maxlifetime = 1
在这种情况下,php垃圾收集器会在每个请求到来时被激活(session.gc_ ......
总记录数:2174; 总页数:363; 每页6 条; 首页 上一页 [235] [236] [237] [238] 239 [240] [241] [242] [243] [244]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号