阿赛·游梦鱼·郭言赛·阿赛工作室

ASP自动批量转移图片实例

  • 发布时间: 2018年1月24日12时37分19秒 最近更新:1-24 发布:asai 编辑:asai 字体:
  • <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%><%Option Explicit%><%
    On Error Resume Next'display err
    'session.abandon
    'Server.ScriptTimeOut=180
    dim conn,adoconn,rs,sql

    '获取参数----0
    dim g_urs,g_urr,g_u0,g_u1,g_u2,g_u3,g_u4,g_u5
    g_urs=Request.ServerVariables("QUERY_STRING")
    g_urs=replace(g_urs,u_gg,"http://www.eesai.com/")
    g_urr=split(g_urs&"////////","/")
    g_u0=g_urr(0)
    g_u1=g_urr(1)
    g_u2=g_urr(2)
    g_u3=g_urr(3)
    g_u4=g_urr(4)
    g_u5=g_urr(5)
    '获取参数----1

    if g_u0="" then:g_u0=0:else:g_u0=int(g_u0):end if
    if g_u1="" then:g_u1=20:else:g_u1=int(g_u1):end if
    if g_u2="" then:g_u2=99999999999999999:else:g_u2=int(g_u2):end if
    if g_u3="" then:g_u3=1:else:g_u3=int(g_u3):end if

    const z_tmt=1'跳转等待秒数
    const z_tmp=5000'一分钟平均完成数量
    const c_pdir="E:\www.77ya.com\eesai\"'转移文件的位置
    'sssssssssssssssssssssssss网站TOP结构与样式表
    Sub asaitop(tpfbt)
    %><!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <meta name="MobileOptimized" content="480">
    <meta name="Iphone-content" content="480">
    <meta name="renderer" content="webkit">
    <meta name="format-detection" content="telephone=no">
    <title><%=tpfbt%></title>
    </head>
    <body><%
    End Sub

    Sub asaiend()
    %>
    <div CLass="ik_g"></div></body>
    </html><%
    End Sub


    Function saipiczy(gyskid,gyskl,gyskb)
    dim sdkt,sdkp,sqla,rsa
    dim sld0,sld1,sld2,sld3,sld4,sld5,sld6,sld7,sld8,sld9,slda,sldb,sldc,sldd,slde,sldf,sldg,sldh,sldi,sldarr,sldbrr,sldcrr,slddrr,slderr,sldfrr,sldgrr,sldhrr
    sdkt=""
    sdkp=" order by "&gyskid&" desc"
    if g_u2>1 then sdkt=gyskid&"<"&g_u2
    if g_u3>1 then
    if sdkt<>"" then
    sdkt=sdkt&" and "&gyskid&">"&g_u3
    else
    sdkt=gyskid&">"&g_u3
    end if
    end if
    if sdkt<>"" then sdkt=" where "&sdkt

    sql="select top "&g_u1&" "&gyskl&" from "&gyskb&sdkt&sdkp
    Call saidbado(1,"服务器,数据库名,用户名,密码")
    set rs=server.CreateObject("adodb.recordset")
    rs.open sql,conn,3,3
    if rs.eof and rs.bof then
    saipiczy="no list!"
    else
    Do While Not rs.eof
    '---------------------------循环处理过程开始000000
    if g_u0=1 then'---------------user

    sld0=rs(0)
    sld1=rs(1)
    sld2=rs(2)
    sld3=rs(3)
    slda=""
    sldb=""
    saipiczy=saipiczy&"<br>---------------【"&sld0&"】---------------"
      if right(sld1,1)="/" or len(sld1)<6 then
      '格式无图数据
      saipiczy=saipiczy&"无图!"
      else
      '转移图片
      slda="user/"&lcase(left(sld2,1))&"/"&sld2&eupmhz(sld1)
      saipiczy=saipiczy&"<br>http://File.77ya.com/"&sld1&"<br>已存储到<br>"&c_pdir&replace(slda,"/","\")&"<br>"
      Call eupurlfile(c_pdir&replace(slda,"/","\"),"http://File.77ya.com/"&sld1)
      end if
      if sld3<>"" then
      sldarr=split(sld3,",")
      'saipiczy=saipiczy&"<br>---------------[【"&ubound(sldarr)&sld3&"】[---------------<br>"
    if ubound(sldarr)=2 then
    sldb="中国"
    for sldi=0 to 2
    sqla="select sName from tbCountry where sID='"&trim(sldarr(sldi))&"'"
    'response.Write sqla&"<br>"
    set rsa=server.CreateObject("adodb.recordset")
    rsa.open sqla,conn,1,1
    if rsa.eof and rsa.bof then
    sldc=""
    else
    sldc=rsa(0)
    end if
    rsa.close
    set rsa=nothing
    sldb=sldb&","&sldc
    if sldi=0 and len(sldc)<3 then sldb=sldb&"省"
    next
    saipiczy=saipiczy&"_________更新us_ct["&sldb&"]<br>"
    end if
      end if
    rs(1)=slda
    rs(3)=sldb
    rs.update

    else'---------------content

    'eesai_id,1eesai_up,2eesai_ew,3eesai_ep,4eesai_tm,5eesai_sn
    sld0=rs(0)
    sld1=rs(1)
    sld2=rs(2)
    sld3=replace(replace(rs(3),"jqr",""),"com","")
    sld4=rs(4)
    sld5=ucase(LEFT(sld3,3))&RIGHT("0000000"&sld0,7)
    sld3="com"&sld3
    'saipiczy=saipiczy&"<br>---------------【"&sld0&sql&"("&g_u0&")("&g_u1&")("&g_u2&")】---------------<br>"
    saipiczy=saipiczy&"<br>---------------【"&sld0&"】---------------<br>"
      if right(sld1,1)="/" or len(sld1)<6 then
      '格式无图数据
      slda=""
      saipiczy=saipiczy&"无图"
      else
      '转移图片
      slda=sld2&"/"&sld3&"/"&LEFT(sld4,4)&"/"&eupmhz(sld1)
      saipiczy=saipiczy&"http://File.77ya.com/"&sld1&"<br>已存储到<br>"&c_pdir&replace(slda,"/","\")
      Call eupurlfile(c_pdir&replace(slda,"/","\"),"http://File.77ya.com/"&sld1)
      end if
    rs(1)=slda
    'response.Write saipiczy
    rs(3)=sld3
    rs(5)=sld5
    rs.update

    end if'---------------over
    '---------------------------循环处理过程结束111111
    rs.movenext
    loop
    end if
    rs.close
    set rs=nothing
    Call saidbclose()
    saipiczy=saipiczy&"<div id=""page""><a HREf=?"&g_u0&"/"&g_u1&"/"&g_u3)&">首页</a><a HREf=""javascript:history.back();"">&laquo; 上一页</a>"
    sldf=int(sld0)-g_u3
    saipiczy="剩余:"&sldf&"条,大概需要"&int(sldf/z_tmp)&"分钟<br>"&saipiczy
    if sldf>0 then
    saipiczy=saipiczy&"<a HREf=?"&g_u0&"/"&g_u1&"/"&sld0&"/"&g_u3)&">下一页 &raquo;</a>"
    saipiczy=saipiczy&"<p align=center>"&aimeta("本页处理完成,即将进入ID<"&sld0&",的TOP"&g_u1&"处理。","?"&g_u0&"/"&g_u1&"/"&sld0&"/"&g_u3)&"</p>"
    end if
    saipiczy=saipiczy&"</div>"
    End Function


    Call asaitop("图片转移")
    %><h1><%=now()%></h1>
    <%=saipiczy("eesai_id","eesai_id,eesai_up,eesai_ew,eesai_ep,eesai_tm,eesai_sn","ees_ai")%>
    <%
    Call asaiend()




    'Call eupurlfile("D:\WWW\u\uuu\123","http://file.02590.com/C16/uploads/tuku/20160516/1463383991223830.jpg")
    '★保存远程文件
    Sub eupurlfile(epsvfile,epurlfile)
    On Error Resume Next'display err
    'epsvfile=epsvfile&eupmhz(epurlfile)
    if eupmfolder(epsvfile) then
    dim asuado,asuxml,asurdata
    Set asuxml=Server.CreateObject("Microsoft.XMLHTTP")
    With asuxml
    .Open "Get",epurlfile,False,"",""
    .Send
    asurdata=.ResponseBody
    End With
    Set asuxml=Nothing
    Set asuado=Server.CreateObject("A"&"dod"&"b.St"&"r"&"eam")
    With asuado
    .Type=1
    .Open
    .Write asurdata
    .SaveToFile epsvfile,2
    .Cancel()
    .Close()
    End With
    Set asuado=nothing
    end if
    End Sub
    '★读取文件后缀名/文件名
    Function eupmhz(anko)
    dim eudrr
    eudrr=split(anko,"/")
    'eupmhz="."&lcase(split(eudrr(ubound(eudrr)),".")(1))
    eupmhz=lcase(eudrr(ubound(eudrr)))
    End Function
    '★创建文件夹
    Function eupmfolder(anko)
    eupmfolder=False
    if anko<>"" then
    dim eupmfolderfso,ankofs,anfdrr,anfdii,anfdud,anfdir
    anfdir=""
    On Error Resume Next'display err
    ankofs=anko
    anfdrr=split(ankofs,"\")
    anfdud=ubound(anfdrr)-1
    Set eupmfolderfso=Server.CreateObject("Scr" & "ipt" & "ing.Fil" & "eSy" & "ste" & "mOb" & "j" & "ect")
    If eupmfolderfso.FolderExists(ankofs) Then
    eupmfolder=True
    Exit Function
    End If
    For anfdii=0 To anfdud
    anfdir=anfdir&anfdrr(anfdii)&"\"
    If Not eupmfolderfso.FolderExists(anfdir) Then
    eupmfolderfso.CreateFolder(anfdir)
    End If
    Next
    Set eupmfolderfso=Nothing
    If Err=0 Then eupmfolder=True
    end if
    End Function



    '---------------------------
    '连接数据库
    '---------------------------
    Sub saidbado(saicdbty,saicdbstr)
    dim saidbarr
    saidbarr=split(saicdbstr,",")
    if saicdbty=1 then'MSSQL
    Set conn=Server.CreateObject("ADODB.CONNECTION")
    adoconn="Provider=Sqloledb;Data Source="&saidbarr(0)&";Initial Catalog="&saidbarr(1)&";User ID="&saidbarr(2)&";Password="&saidbarr(3)&";"
    else'ACCESS
    set conn=server.CreateObject("ADODB.CONNECTION")
    adoconn="Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Password="&saidbarr(1)&";Data Source="&Server.MapPath(""&saidbarr(0)&"")
    end if
    conn.open adoconn
    End Sub
    '---------------------------
    '关闭数据库
    '---------------------------
    Sub saidbclose()
    conn.Close
    Set conn=Nothing
    End Sub

    '-----------------------------------
    '跳转等待
    '-----------------------------------
    Function aimeta(aifstr,aifurl)
    aimeta="<script>function asaigobgt(){location.replace("""&aifurl&""");}setTimeout('asaigobgt()',"&z_tmt&"000);</script>"
    aimeta=aimeta&"<p align=center>"&aifstr&"<br><a HREf="&aifurl&">请等待 "&z_tmt&" 秒后自动跳转,或点击这里即时跳转!</a></p>"
    End Function
    %>
    Powered by eesai.Com ©  2018  阿赛工作室 All Rights Reserved
    本网站由 阿赛工作室 提供源代码技术支持.  备案号:苏ICP备18000000号

    网站地图建议反馈MapRssXml回到顶部