Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local WebsiteDatabase = "http://www.ccnet.netau.net/php/folder/" --Folder with all the sites
- local ApiPath = "http://www.ccnet.netau.net/php/mcmain.php" --Path API is stored
- function upload(path, domain, debug, user, pass)
- if user and pass then else
- user = "guest"
- pass = "guest"
- end
- if fs.exists(path) then
- file = fs.open(path, "r")
- if file then
- data = file.readAll()
- file.close()
- if not data then
- print("Failed to read " ..path)
- return
- end
- local response = http.post(
- ApiPath,
- "type=upload&"..
- "user=guest&"..
- "pass=guest&"..
- "name=".. textutils.urlEncode(domain) .. "&"..
- "data=".. textutils.urlEncode(data)
- )
- if response then
- local sResponse = response.readAll()
- response.close()
- print("Done!")
- print("Log: ")
- sleep(0.5)
- if sResponse == "success" then
- if debug then
- print("Uploading " ..shell.resolve(path).. " complete!")
- print("Errors: 0")
- print("\nGo to " ..domain.. " to check the site!")
- end
- return sResponse
- else
- if debug then
- print("Failed : " ..sResponse)
- end
- return sResponse
- end
- else
- if debug then
- print("Failed to connect to database.")
- end
- end
- else
- if debug then
- print("Failed to open " ..path)
- end
- end
- else
- if debug then
- print(path.. " doesn't exist.")
- end
- end
- end
- function delete(path, user, pass)
- local response = http.post(
- ApiPath,
- "type=delete&"..
- "user=" ..user.. "&"..
- "pass=" ..pass.. "&"..
- "name=".. textutils.urlEncode(path)
- )
- return response.readAll()
- end
- function lister()
- local response = http.post(
- ApiPath,
- "type=list&"..
- "user=guest&"..
- "pass=guest"
- )
- return response.readAll()
- end
Advertisement
Add Comment
Please, Sign In to add comment