修补upfile.asp上传漏洞

Filed Under (ASP茶座) by 有为 on 29-07-2009

ASP文件相关的一些函数。有以下几个:
1. 得到文件扩展名
2. ASP上传文件漏洞检测
3. 格式化显示文件大小
4. asp检测上传图片是否为真实图片
5. 上传文件扩展名检测
6. 取得文件对应的图标
7. 下载文件等相关函数

程序代码:
<%
‘*******************************************************
‘作    用: 得到文件扩展名
‘函数名: GetFileExt(fileTrue)
‘参    数: sFileName 文件名
‘返回值: 返回文件扩展名
‘*******************************************************
function GetFileExt(sFileName)
GetFileExt = UCase(Mid(sFileName,InStrRev (sFileName, “.”)+1))      ‘下面有附
End function

‘*******************************************************
‘作    用: ASP上传漏洞 “\0″ 防范
‘函数名: TrueStr(fileTrue)
‘参    数: sFileName 文件名
‘返回值: 合法文件返回 True ,否则返回False
‘*******************************************************
function IsTrueFileName(sFileName)
dim str_len,pos
str_len=len(sFileName)
pos=Instr(sFileName,chr(0))
If pos=0 or pos=str_len then
IsTrueFileName = true
else
IsTrueFileName = false
End If
End function « 阅读全文 »

fckeditor自动换行

Filed Under (FCKeditor) by 有为 on 28-07-2009

找到fckeditor\editor\css\fck_editorarea.css文件进行修改
body, td
{
font-family: 宋体,黑体,隶书,楷体_GB2312,Arial, Verdana, Sans-Serif;
font-size: 16px;
width:750px;//编辑区大小
word-break:break-all;//自动换行
}

FCKeditor中js报错“未结束的字符串常量”,解决办法(ASP)

Filed Under (FCKeditor) by 有为 on 26-07-2009

<script type=”text/javascript”>
var oFCKeditor = new FCKeditor( ‘TxtFileds’ ) ;
oFCKeditor.BasePath = ‘fckeditor/’ ;
oFCKeditor.ToolbarSet = ‘Default’ ;
oFCKeditor.Width = ‘100%’ ;
oFCKeditor.Height = ‘400′ ;
oFCKeditor.Value = ‘<%=replace(tmp_Content,chr(13)&chr(10),”")%>’ ;
oFCKeditor.Create() ;
</script>

使用js向FCKeditor编辑器中插入数据,即js获取FCKeditor引用的方法

Filed Under (FCKeditor) by 有为 on 26-07-2009

<script language=”javascript” src=”fckeditor/fckeditor.js” type=”text/javascript”></script>

1.实例化

<script type=”text/javascript”>
var oFCKeditor = new FCKeditor( ‘TxtFileds’ ) ;
oFCKeditor.BasePath = ‘fckeditor/’ ;
oFCKeditor.ToolbarSet = ‘Default’ ;
oFCKeditor.Width = ‘100%’ ;
oFCKeditor.Height = ‘400′ ;
oFCKeditor.Value = ” ;
oFCKeditor.Create() ;
</script>

2.向编辑器中插入数据

function InsertEditor(InsertValue)
{
var oEditor = FCKeditorAPI.GetInstance(’TxtFileds’) ;
if (oEditor.EditMode != FCK_EDITMODE_WYSIWYG ){
oEditor.SwitchEditMode();
alert(’对不起,必须在编辑模式下进行插入操作!’);
}
else{
oEditor.InsertHtml(InsertValue);
}
}

FCKeditor编辑器js调用方法

Filed Under (FCKeditor) by 有为 on 26-07-2009

FCKeditor js调用方法
<script src=”FCKeditor/FCKeditor.js”></script>
<script type=”text/javascript”>

var oFCKeditor = new FCKeditor( ‘Content’ ) ;
oFCKeditor.BasePath = ‘FCKeditor/’ ;
oFCKeditor.ToolbarSet = ‘Basic’ ;
oFCKeditor.Width = ‘100%’ ;
oFCKeditor.Height = ‘400′ ;
oFCKeditor.Value = ” ;
oFCKeditor.Create() ;
</script>