xXm0dzXx

Untitled

Aug 25th, 2012
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. local WebsiteDatabase = "http://www.ccnet.netau.net/php/folder/" --Folder with all the sites
  2. local ApiPath = "http://www.ccnet.netau.net/php/mcmain.php" --Path API is stored
  3.  
  4. function upload(path, domain, debug, user, pass)
  5. if user and pass then else
  6. user = "guest"
  7. pass = "guest"
  8. end
  9.  
  10. if fs.exists(path) then
  11. file = fs.open(path, "r")
  12. if file then
  13. data = file.readAll()
  14. file.close()
  15. if not data then
  16. print("Failed to read " ..path)
  17. return
  18. end
  19. local response = http.post(
  20. ApiPath,
  21. "type=upload&"..
  22. "user=guest&"..
  23. "pass=guest&"..
  24. "name=".. textutils.urlEncode(domain) .. "&"..
  25. "data=".. textutils.urlEncode(data)
  26. )
  27.  
  28. if response then
  29. local sResponse = response.readAll()
  30. response.close()
  31. print("Done!")
  32. print("Log: ")
  33. sleep(0.5)
  34. if sResponse == "success" then
  35. if debug then
  36. print("Uploading " ..shell.resolve(path).. " complete!")
  37. print("Errors: 0")
  38. print("\nGo to " ..domain.. " to check the site!")
  39. end
  40. return sResponse
  41. else
  42. if debug then
  43. print("Failed : " ..sResponse)
  44. end
  45. return sResponse
  46. end
  47. else
  48. if debug then
  49. print("Failed to connect to database.")
  50. end
  51. end
  52. else
  53. if debug then
  54. print("Failed to open " ..path)
  55. end
  56. end
  57. else
  58. if debug then
  59. print(path.. " doesn't exist.")
  60. end
  61. end
  62. end
  63.  
  64. function delete(path, user, pass)
  65. local response = http.post(
  66. ApiPath,
  67. "type=delete&"..
  68. "user=" ..user.. "&"..
  69. "pass=" ..pass.. "&"..
  70. "name=".. textutils.urlEncode(path)
  71. )
  72.  
  73. return response.readAll()
  74. end
  75.  
  76. function lister()
  77. local response = http.post(
  78. ApiPath,
  79. "type=list&"..
  80. "user=guest&"..
  81. "pass=guest"
  82. )
  83.  
  84. return response.readAll()
  85. end
Advertisement
Add Comment
Please, Sign In to add comment