PHP:使用MySQL保存SESSION会话
2008/08/26 22:11 | by shangzhihao ]
使用MySQL保存session会话较files有很多优点:
1) 有利于分布式系统,files只能保存在一台机器上
2) 有利于大访问量的系统,使用files时每个session保存在一个文件中,目录会超级大,查找session文件会比较困难,当然,也可以自己写一个有hash目录的替代。
linux为单网卡配置多个IP地址
2008/08/23 08:39 | by shangzhihao ]
1.使用命令进行配置
这就很简单了,首先查看一下当前机器的IP地址,命令如下:
#ifconfig
eth0 Link encap:Ethernet HWaddr 00:19:D1:24:2A:EC
inet addr:192.168.1.55 Bcast:192.168.3.255 Mask:255.255.252.0
inet6 addr: fe80::219:d1ff:fe24:2aec/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
注意看其中的红色部分,可以看到我们本机的IP地址为1.55,那么我们来配一个1.56(注意不要和局域网内的地址冲突哦),使用命令如下:
#ifconfig eth0:0 192.168.1.56 netmask 255.255.252.0
#ifconfig
eth0 Link encap:Ethernet HWaddr 00:19:D1:24:2A:EC
inet addr:192.168.1.55 Bcast:192.168.3.255 Mask:255.255.252.0
inet6 addr: fe80::219:d1ff:fe24:2aec/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth0:0 Link encap:Ethernet HWaddr 00:19:D1:24:2A:EC
inet addr:192.168.1.56 Bcast:192.168.3.255 Mask:255.255.252.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
MS IE 7 setRequestHeader() 请求拆分和渗透漏洞
2008/07/31 18:16 | by shangzhihao ]
IE 7允许通过HTTP请求拆分攻击覆盖Content-Length、Host和Referer等HTTP头,导致HTTP头信息欺骗。
类似于以下javascript:
var x=new XMLHttpRequest();
x.open("POST","/");
for(f=127;f<255;f++)
try{
x.setRequestHeader("Host"+String.fromCharCode(f),"Test");
}catch(dd){}
x.setRequestHeader("Connection","keep-alive");
x.onreadystatechange=function (){
if (x.readyState == 4){
}
}
x.send("blah");
javaScript中URL编码转换,escape() encodeURI() encodeURIComponent()
2008/07/28 10:17 | by shangzhihao ]
javascript通用表单验证
2008/06/25 14:49 | by shangzhihao ]
表单做为客户端向服务器提交数据的载体担当相当重要的角色.
这就引出了一个问题,提交的数据合法吗?摆在我们面前的问题就是验证这些数据
保证所提交的数据是合法的.所以,我们写了一个大堆的验证函数.当我们开始新的一个
项目的开发时,我们又得写一大堆的验证函数,然后再调试这一大堆的函数...
本文将介绍一种方法来提高我的代码的可重用性,提高我们的开发效率.
个人以为表单的验证应该包含两部分:
第一,判断用户输入的数据是否合法.
第二,提示用户你的数据为什么是不合法的.
所以,我们的通用表单验证函数要实现的功能就是:
第一,取得用户输入的数据GetValue(el)
第二,验证用户的数据CheckForm(oForm)
xajax如何获取fckeditor的值
2008/06/25 11:51 | by shangzhihao ]
function GetContents()
{
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance('content1') ;
// Get the editor contents in XHTML.
//alert( oEditor.GetXHTML( true ) ) ; // "true" means you want it formatted.
var a = oEditor.GetXHTML( true );
xajax_show(a);
}
Zend Studio SVN 使用方法
2008/06/23 19:33 | by shangzhihao ]
Zend Studio 4只支持CVS, Zend Studio 5 开始加入subversion的支持,后者的使用比较简单,本文以后者
与Zend Studio集成使用为例做说明。
Zend Studio默认使用CVS,可在“工具”->“首选项”->“source control”中选择Subversion即可。
配置Zend Studio客户端使用SVN:
打开“工具”->“subversion”->”checkout“,显示如下对话框:
Module ULR 指要下载的源程序在源码库的位置,如图所示
工作目录是下载到本机的程序存放位置,如图所示,如果所填目录不存在,则程序自动创建。
用户名密码如果不需要的时候默认为空。
javascript获取url参数
2008/06/20 12:52 | by shangzhihao ]
<head>
<title>获取url变量</title>
<script type="text/javascript">
function getParameter(parameter)
{
var Url,Para,Paras,tmpStr;
Url = document.location.toString();//获取url
Paras = Url.substr(Url.indexOf("?")+1);//获取?后边的字符串
Para = Paras.split("&");//将参数分开
for(i=0;i<Para.length;i++)//循环对比所需的参数
{
tmpStr = Para[i];
if(tmpStr.substring(0,tmpStr.indexOf("=")) == parameter)
{
return tmpStr.substr(tmpStr.indexOf("=")+1);
}
}
}
</script>
</head>
<body>
<script type="text/javascript">
if(Url = document.location.toString().indexOf("?a=oo") == -1)
document.location = Url = document.location.toString() + "?a=oo";
document.write(getParameter("a"));
</script>
</body>
</html>
FCKeditor 的配置和使用方法(for PHP)
2008/06/15 13:32 | by shangzhihao ]
FCKeditor 截至 2008年4月6日,其最新版本是 2.6RC,RC 就是 Release Candidate,修订后的候选版本,很可能作为该版本的稳定版在未来发布。目前的最新的稳定版(Latest Stable)是 2.5.1。我们可以到他的官方网站上去下载 http://www.FCKeditor.net 合适的版本,开源、免费的。
本文介绍 PHP 中的配置方法,其他语言的配置方法和它是基本一样的。
eclipse的几个插件安装地址
2008/06/12 08:45 | by shangzhihao ]
<bookmarks>
<site name="aptana" url="http:// update.aptana.com/install/3.2/" web="false" selected="false" local="false"/>
<site name="pdt" url="http:// download.eclipse.org/tools/pdt/updates/" web="false" selected="false" local="false"/>
<site name="WebTool(WTP)" url="http:// download.eclipse.org/webtools/updates/" web="false" selected="false" local="false"/>
<site name="EPIC" url="http:// e-p-i-c.sourceforge.net/updates/testing" web="false" selected="false" local="false"/>
<site name="Python" url="http:// pydev.sourceforge.net/updates/" web="false" selected="false" local="false"/>
<site name="EMF Service Data Objects (SDO) Updates" url="http:// download.eclipse.org/modeling/emf/updates/" web="false" selected="false" local="false"/>
<site name="Eclipse Modeling Framework Technologies (EMFT) Updates" url="http:// download.eclipse.org/technology/emft/updates/" web="false" selected="false" local="false"/>
<site name="Data Tools Platform (DTP) Updates" url="http:// download.eclipse.org/datatools/updates" web="false" selected="false" local="false"/>
<site name="Model Developement Tools (MDT) Updates" url="http:// download.eclipse.org/modeling/mdt/updates/" web="false" selected="false" local="false"/>
<site name="The Eclipse Project Updates" url="http:// update.eclipse.org/updates/3.3" web="false" selected="false" local="false"/>
<site name="Web Tools Platform (WTP) Updates" url="http:// download.eclipse.org/webtools/updates" web="false" selected="false" local="false"/>
<site name="Europa Discovery Site" url="http:// download.eclipse.org/releases/europa" web="false" selected="false" local="false"/>
<site name="Pydev Extensions discovery site" url="http:// w ww.fabioz.com/pydev/updates" web="false" selected="false" local="false"/>
<site name="The Eclipse Project Updates" url="http:// update.eclipse.org/updates/3.2" web="false" selected="false" local="false"/>
<site name="Callisto Discovery Site" url="http:// download.eclipse.org/callisto/releases" web="false" selected="false" local="false"/>
</bookmarks>
将上边的xml文件保存下来,直接导入即可,这几个插件主要是做web开发的。





