存档

‘Show(展示)’ 分类的存档

猫七URL转发系统 立即下载
‘=============================================================
‘= Copyright (c) 2010 猫七(QQ:77068320) =
‘= All rights reserverd. [...]

六 15th, 2010 | Filed under ASP, Products(作品), Show(展示)

本文为catseven落伍缩写,已发到落伍者,供catseven落伍。如有引用,请注明出处。
       因为工作,经常要操作数据库,考虑到安全问题,在防火墙中没有开mssql端口。每次遇到必须使用查询分析器的时候,就麻烦了。为了方便工作,写了这个工具。
      可以操作所有ADODB连接的数据库,当然包括MSSQL,MySQL,Access….

     本工具分为两个部分。控制代码和输入代码。
     控制代码就是VBScript部分,可以实现所有逻辑操作,和asp操作一样。
      输入部分就是Link、SQL分别用于输入连接字符串,SQL语句。如果控制代码不调用这些语句,则这部分无实际意义。
       默认,控制代码已经写好一个模板。点击执行,可以执行SQL语句,点击下载,将执行结果保存到Excel中。
       因为能直接操作VbScript,如果要使用,请设置好权限。新建mssql用户,在iis中设置mssql.asp以mssql的身份执行。mssql.asp的访问权限只有mssq用户。mssql对所有文件无任何权限,对mssql.asp只有可读权限。
      代码如下:

<%
Server.ScriptTimeout = 9999
starttime = timer()
cmd = request("cmd")

if request("out")="xls" and trim(cmd)<>"" then
response.ContentType = "application/octet-stream"
response.AddHeader "Content-Disposition", "attachment;filename=执行结果.xls"
execute(cmd)
response.end
end if
%>
<style type="text/css">
form{text-align:center}
textarea{width:100%;height:200px;border:solid 1px #CCC;}
input{height:20px;vertical-align:middle}
input.input{border:solid 1px #CCC;width:40%;line-height:18px;color:#090}
a{font-size:12px;color:#C00;text-decoration:none;}
</style>
<form action="mssql.asp" method="post">
<textarea name="cmd">
<%
if trim(cmd)="" then
%>set Conn = Server.CreateObject("ADODB.Connection")
Conn.open Request("link")

Set Rs=Conn.Execute(Request("sql"))
for i = 0 to Rs.Fields.Count-1
[...]

六 12th, 2010 | Filed under ASP, Products(作品), Share(分享), Show(展示), Thinks(想法)

< %
set FSO = Server.CreateObject("Scripting.FileSystemObject")

Function CheckFile(byval Path)
pathArr = Split(Path,"/")
Path = replace(Path,"/" & pathArr(ubound(pathArr)),"")
if Path = "" then Exit Function
if not FSO.FolderExists(Server.Mappath(Path)) then
Call CheckFile(Path)
FSO.CreateFolder(Server.Mappath(Path))
end if
End Function

Function newFile(byval Path)
if Right(Path,1)="/" then
Path = Path & "index.html"
end if
Call CheckFile(Path)
Set newFile = FSO.CreateTextFile(Server.Mappath(Path))
End Function

set n = newFile("/index/cat2/path/demo/111/222/333/444/555/666/777/888/")
n.write "12345"
n.close
set n = nothing

set n = newFile("../../../../test.css")
n.write "body{}"
n.close
set n = nothing
%>

六 2nd, 2010 | Filed under ASP, Share(分享), Show(展示), Thinks(想法)

1.下载地址
         http://www.miaoqiyuan.cn/products/webzip.rar
2.程序源码
        http://www.miaoqiyuan.cn/p/webzip-code
3.使用说明
         http://www.miaoqiyuan.cn/p/webzip-demo
4.未解决问题
       ADODB.Stream读取asp文件时,如果文件结尾为%>,则%后的>会被忽略掉,现在本人暂未解决这个问题,用户可以在以%>结尾的asp文件,请在后边添加一个空格或换行符,恢复后程序即可正常使用。

三 27th, 2010 | Filed under Share(分享), Show(展示)

1.下载&安装
       到http://www.miaoqiyuan.cn/products/webzip.rar,保存为webzip.rar以供备用。
2.压缩

       将webzip.rar中的webzip.asp、webzip.asp.webzip解压到要压缩的目录。在浏览器中访问[hostname]/[保存路径]/webzip.asp打开本工具,点击压缩,稍等片刻,即可打包完毕。
3.上传
     将webzip.asp、webzip.asp.webzip通过FTP或在线文件管理系统上传到您的站点目录。
4.解压

     在浏览器中访问[hostname]/[保存路径]/webzip.asp,选择解压。稍等片刻,您的整个站点将会在服务服务器上解压完毕。
    至此,您的整个站点即可正常使用了。
[Debug]
1.ADODB.Stream读取asp文件时,如果文件结尾为%>,则%后的>会被忽略掉,现在本人暂未解决这个问题,用户可以在以%>结尾的asp文件,请在后边添加一个空格或换行符,恢复后程序即可正常使用。
2.如果您在使用中发现出现某些问题,可直接致邮:mqycn@126.com

猫七原创ASP压缩解压系统-WEBZip,原理即遍历当前目录的所有文件和文件夹,将结果保存到MDB数据库中。现在已经实现了ASP无需任何插件,仅用Access数据库。
全部代码如下:

<%
Server.ScriptTimeout=9999
Response.Buffer=false

Dim WEBZip_Path,WEBZip_Date,WEBZip_CMD,WEBZip_File
Dim WEBZip_FSO,WebZip_Conn,WEBZip_Rs,WEBZip_ADOStrem

‘压缩相关
‘================================================================
Function findFiles(p)
savePath(p)
for each s in p.subfolders
findFiles(s)
next
for each f in p.files
saveFile(f)
next
End Function

Function savePath(p)
If trim(replace(p,WEBZip_Path,""))="" Then Exit Function
RunSqlOne("insert into [p]([p_na],[p_pa],[p_cn])values(‘"&p.name&"’,'"&replace(p,WEBZip_Path,"")&"’,"&p.subfolders.count&")")
echo "找到路径:"&p
End Function

Function saveFile(f)
If instr(f,WEBZip_File)>0 Then Exit Function
RunSqlOne("insert into [f]([f_na],[f_pa],[f_sz])values(‘"&f.name&"’,'"&replace(f,WEBZip_Path,"")&"’,"&f.size&")")
SaveFileContent(replace(f,WEBZip_Path,""))
echo "压缩文件:"&f
End Function

‘写入文件内容
Function SaveFileContent(f)
fl=WEBZip_FSO.getfile(Server.Mappath(f))
WEBZip_Rs.Open "select * from [f] where [f_pa]=’"&f&"’",WEBZip_Conn,3,2
With WEBZip_ADOStrem
.Type = 1
.Open
.LoadFromFile fl
WEBZip_Rs("f_co") = .Read
.Close
End [...]

三 25th, 2010 | Filed under ASP, Products(作品), Share(分享), Show(展示), Thinks(想法)
标签: , ,