Remote update of script
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Remote update of script

Started by TecMaster, 03 December, 2004, 10:06:10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TecMaster

I have search but not found a script for admins that allow them to remote update scripts in other network hubs. Someone that can help me with that?

Dj_OcTaGoN

You mean something like this?

-- save string
-- by chill
-- Great script chill ....thx

-- Minor Mods by Mutor
-- Added Right Click Menu
-- Added help
--
--- touched by Herodes 6 / 8 - 2004
--- secured all the folders apart from 'scripts' folder of PtokaX
--- added folder operations ... (create / delete ) 7 / 8 - 2004
--
-- +save filename text 
-- e.g. +save txt/textfile.txt text 
--
-- +load filename 
-- +del filename 
-- +list dir
-- +edhelp 
--
--
aprof = 0 -- for only masters
secure = "on"  --- change to anything else to be able to access any folder any where on the pc its running on...
thisfile = "texteditor.lua"		--- !! SECURITY WARNING !! --- BE SURE TO PUT THE FILENAME OF THIS SCRIPT HERE (replace between the quotes ex: "filename.lua" )
--

function NewUserConnected(curUser)
	if curUser.iProfile == aprof then
		customCMDS(curUser)
		curUser:SendData(" *** Notice :: Right click hub tab for editor commands. ***")
	else
		return
	end
end

OpConnected = NewUserConnected

--$UserCommand 1 X  Where -> 1=Hub Menu 2=User Menu 3=Hub/User Menu 
function customCMDS(curUser)
	--curUser:SendData("$UserCommand 255 7")	--clear the menu first
	curUser:SendData("$UserCommand 1 3 [Editor]\\List Dir $<%[mynick]> +list %[line:Folder]||")
	curUser:SendData("$UserCommand 1 3 [Editor]\\Read File $<%[mynick]> +load %[line:Path/Filename]||")
	curUser:SendData("$UserCommand 1 3 [Editor]\\Save File $<%[mynick]> +save %[line:Path/Filename] %[line:Text]||")
	curUser:SendData("$UserCommand 1 3 [Editor]\\Delete File $<%[mynick]> +del %[line:Path/Filename]||")
	curUser:SendData("$UserCommand 1 3 [Editor]\\Create Dir $<%[mynick]> +dirdo %[line:Name of Folder]||")
	curUser:SendData("$UserCommand 1 3 [Editor]\\Delete Dir $<%[mynick]> +dirdel %[line:Name of Folder]||")
	curUser:SendData("$UserCommand 1 3 [Editor]\\Editor Help $<%[mynick]> +edhelp .||")
end

function	DataArrival(curUser,data)
	if (strsub(data,1,1) == "<") and (curUser.iProfile == aprof) then
		local _,_,cmd,fileordir = strfind(data,"^%b<>%s+(%S+)%s+([^|^ ]+)")
		if fileordir ~= "" and fileordir ~= nil then
			if strfind(fileordir, thisfile) and secure == "on" then
				curUser:SendData(curUser.sName, "Sorry I can't allow you to access this file ...")
				return 1
			else
				if cmd == "+save" then
					local _,_,sdata = strfind(data,"^%b<>%s+%S+%s+%S+%s+(.*)|$")
					if sdata then
						SaveFile(fileordir,sdata)
						SendPM(curUser,"Saved data to: "..fileordir)
					end
					return 1
				elseif cmd == "+load" then
					local sdata = LoadFile(fileordir)
					SendPM(curUser,"File Loaded: "..fileordir..",\r\n"..sdata)
					return 1
				elseif cmd == "+del" then
					DelFile(fileordir)
					SendPM(curUser,"Deleted File: "..fileordir)
					return 1
				elseif cmd == "+list" then
						if strfind(fileordir, "/%.%.") and secure == "on" then
							curUser:SendData(curUser.sName, "You cant access this folder I am afraid ... sorry")
							return 1
						else 
							local dir = ListDir(fileordir)
							SendPM(curUser,dir)
							return 1
						end
				elseif( strfind(data, "+edhelp" ,1))  then
					hmsg = "\r\n"
					hmsg = hmsg.."\r\n\t--<>----------------------------------------------------------------------------<>--"
					hmsg = hmsg.."\r\n\t\t\t [ Editor Help ]"
					hmsg = hmsg.."\r\n\t--<>----------------------------------------------------------------------------<>--"
					hmsg = hmsg.."\r\n\t+save \t=\tSave to file\t-> 'path/filename' 'text'"
					hmsg = hmsg.."\r\n\t+load \t=\tLoad a file\t-> 'path/filename'"
					hmsg = hmsg.."\r\n\t+del \t=\tDelete file\t\t-> 'path/filename'"
					hmsg = hmsg.."\r\n\t+list \t=\tList folder\t\t-> 'path' [/ = scripts dir]"
					hmsg = hmsg.."\r\n\t+dirdo\t=\tCreate folder\t-> 'foldername'"
					hmsg = hmsg.."\r\n\t+dirdel\t=\tDelete folder\t-> 'foldername'"
					hmsg = hmsg.."\r\n\t+edhelp \t=\tShow help"
					hmsg = hmsg.."\r\n\t--<>----------------------------------------------------------------------------<>--"
					SendPM(curUser,hmsg)
					return 1
				elseif cmd == "!banip" then
					local ip = fileordir
					local handle = openfile("ipban/"..date("%d%m%Y").."-ipban.txt","a")
					write(handle,date("%d/%m/%Y-%H:%M:%S")..", Banner: "..curUser.sName..", Banned IP: "..ip.."\n")
					closefile(handle)
				elseif cmd == "+dirdo" then
					execute("mkdir "..fileordir)
					SendPM(curUser,"Created Folder: "..fileordir)
					return 1
				elseif cmd == "+dirdel" then
					if strfind(fileordir, "/%.%.") and secure == "on" then
						curUser:SendData(curUser.sName, "You cant delete this folder ... sorry")
						return 1
					else
						execute("rmdir "..fileordir)
						SendPM(curUser,"Deleted Folder: "..fileordir)
						return 1
					end
				end
			end
		end
	end
end

function SendPM(curUser,data)
	curUser:SendPM(curUser.sName,data)
end


function SaveFile(filename,sdata)
	local handle = openfile(filename,"w")
	write(handle,sdata)
	closefile(handle)
end

function LoadFile(filename)
	local handle = openfile(filename,"r")
	local sdata = ""
	if handle then
		sdata = read(handle,"*a")
		sdata = gsub(sdata,"|",strchar(166))
		sdata = gsub(sdata,"\n","\r\n")
		closefile(handle)
	end
	return sdata
end

function DelFile(filename)
	remove(filename)
end

function ListDir(dir)
	if (dir == "/") or (dir == "dir") then
		dir = ""
	end
	--execute("dir \""..dir.."\" /a-d /b > dirlist.txt")	--Show Directories in bare format
	--execute("dir \""..dir.."\" /b > dirlist.txt")		--Bare Format
	--execute("dir \""..dir.."\" /a-d > dirlist.txt")	--Show Directories
	execute("dir \""..dir.."\" /o:gn > dirlist.txt")	--Show Directories first then files , by name
	local sdata = LoadFile("dirlist.txt")
	DelFile("dirlist.txt")
	return("\r\n"..sdata)
end


TecMaster

Yeah, just like that. Thanks alot.
? trevlig Helg  :))

Dj_OcTaGoN



SMF spam blocked by CleanTalk