Jan 26 2008

找到包含php文件的目录

Category: 技术ssmax @ 23:17:03

由于空间的php.ini要求放到所有包含php的子目录里面才行,写了一行命令执行,记录之。。。

find . -type f -iname "*.php" | sed "s/[^\/]*$//" | sort | uniq | xargs -i cp -f php.ini {}

 


Jan 26 2008

关闭wordpress的全角转换

Category: 技术ssmax @ 18:08:07

wordpress在显示的时候会对引号之类的做全角转换,可能是为了防止一些网页代码之类的吧,反正搞到我贴代码的时候很烦,编辑n次都不行,今天一个火起看了一下源代码,在wp-includes/formatting.php 里面,屏蔽掉

 // static strings
 // $curl = str_replace($static_characters, $static_replacements, $curl);
 // regular expressions
 // $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
 

一个静态转换,一个动态正则转换,懒得看是转换了什么,全部屏蔽,出问题再算。。


Jan 26 2008

perl cgi virtual shell console

Category: 技术ssmax @ 17:30:05

这两天在新空间申请ssh shell access,还没有开通,又把cgi 翻了出来应急,参考网上一个php shell的脚本改了一下,主要抄了ajax的部分,嘿嘿,用php的system函数会涉及到占用内存和php执行时间的问题,有很多shell命令都无法正常执行,所以还是用perl cgi来得实际。。。

perl cgi virtual shell console:

 

 

 

#!/usr/bin/perl
use CGI;
my $command = CGI::param('cmd') || '';
my $pwd = CGI::param('pwd') || `pwd`;

print ("Content-Type: text/plain;\n");
print ("Cache-Control: no-cache\n\n");
#print "change dir: ".`cd $pwd 2>&1`."\n";
#print "now dir: ".`pwd`."\n";
#print "command: ".$command."\n\n";
if($command ne '') {
print `cd $pwd; $command 2>&1`;
}
else {
$~ = "MYFORMAT";
write;
format MYFORMAT =
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHP AJAX Shell</title>
<script type="text/javascript" language="javascript">
var CommHis=new Array();
var HisP;
function doReq(_1,_2,_3){var HR=false;
if(window.XMLHttpRequest){HR=new XMLHttpRequest();
if(HR.overrideMimeType){HR.overrideMimeType("text/xml");}}
else{if(window.ActiveXObject){
try{HR=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{HR=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}}}}
if(!HR){return false;}
HR.onreadystatechange=function(){if(HR.readyState==4){
if(HR.status==200){if(_3){eval(_2+"(HR.responseXML)");}
else{eval(_2+"(HR.responseText)");}}}};
HR.open("GET",_1,true);HR.send(null);}
function pR(rS){var _6=document.getElementById("outt");
_6.value+=document.getElementById("cmd").value;
_6.value+="\n";
_6.value+=rS;
_6.value+="\n:->";
_6.scrollTop=_6.scrollHeight;
/*
var _7=rS.split("\n\n");
var _8=document.getElementById("cmd").value;
_6.appendChild(document.createTextNode(_8));
_6.appendChild(document.createElement("br"));
for(var _9 in _7){var _a=document.createElement("pre");
_a.style.display="inline";
line=document.createTextNode(_7[_9]);
_a.appendChild(line);_6.appendChild(_a);
_6.appendChild(document.createElement("br"));}
_6.appendChild(document.createTextNode(":-> "));
_6.scrollTop=_6.scrollHeight;
*/
document.getElementById("cmd").value="";}
function keyE(_b){switch(_b.keyCode){
case 13:
var _c=document.getElementById("cmd").value;
if(_c){CommHis[CommHis.length]=_c;
HisP=CommHis.length;
var _d=document.location.href+"?cmd="+escape(_c)+"&pwd="+escape(document.getElementById("pwd").value);
doReq(_d,"pR");}
break;
case 38:
if(HisP>0){HisP--;
document.getElementById("cmd").value=CommHis[HisP];}
break;
case 40:
if(HisP<CommHis.length-1){HisP++;
document.getElementById("cmd").value=CommHis[HisP];}
break;
default:
break;}}
</script></head>
<body style="font-family:courier">
<form onsubmit="return false">
<textarea id="outt" cols="100" rows="30" style="background-color: #000; color: #3F0;" readonly="readonly">:-&gt;</textarea><br/>
Command: <input tabindex="1" onkeyup="keyE(event)" style="color:#FFF;background:#333;width:100%;" id="cmd" type="text" /><br/>
.
print('WorkDir: <input tabindex="1" style="color:#FFF;background:#333;width:100%;" id="pwd" type="text" value="'.$pwd.'"/>'."\n");
print("</form></body></html>\n");
}


Jan 26 2008

半醉

Category: 乱up当秘笈ssmax @ 11:42:07

昨晚公司的支持部门聚餐,到一家叫味稻工场的地方公费吃喝,又下雨又冷的,走到那里的时候全身差不多都湿了,又冻又饿的,上的菜一道比一道辣,受不了,只有喝酒了。。。而且还要开的是红酒,刚入口没什么,但是后劲足,一围围敬过去,都不管认识不认识,还看到几个mm十分愕然,估计在想这丫谁啊。。。。我和chyi刚敬了一圈就开始头晕,然后又去敬罗总,走的时候头脑还清醒,但是眼睛已经模糊了,脚步浮浮,很久没有喝到这么醉了。。。今天的头还在疼。。。

今天一早comx就来问我有啥打算,说自己快要组长了,其实书生1年多前已经是tx的部门leader了,串升得狠快。。。估计之前我们到客服也会有leader做做吧,但还是喜欢这边的自由,随波逐流就好而来,我做人从来也没有什么大想法,就一凡人。。。