Could someone write a script to compare and edit the userdatabase between 2 (or more) hubs running on the same computer with different Ports?
For example:
User registers himself (or gets registered) in Hub A, and at the same time he gets registered in Hub B allowing connection to that Hub as well.
Hub A should register the new User in Hub B automaticaly
i dont need any cmd's for this as it should be done completly on it's own.
the only thing i would have to be able to edit are the hubadresses and ports or the path to the RegisteredUsers.dat whichever would be needed to accomplish the task.
any help would be appreciated
If both hubs are ptokax, then we can do a script that copies RegisteredUsers.dat to the folders between the 2 ptokax lol, but i dont know what to trigger it with. Altho i can make it for ya.
QuoteOriginally posted by bastya_elvtars
If both hubs are ptokax, then we can do a script that copies RegisteredUsers.dat to the folders between the 2 ptokax lol, but i dont know what to trigger it with. Altho i can make it for ya.
the idea is good but not the files.
ptokax only reads those on startup, so you need a seperate files.
have both hub's write new users 2 there own file, and let the hub's read eachothers files on a timer and delete it after processing.
plop
U mean by triggering a regusers.dat reading process and if the users aint registered, ptokax adds them auto? Ok, gonna deal with that l8r...
well there's a website registration script whizzing round somewhere here that also allows registering from outside the hub. just that it doesnt check if username is registered already so when 2 ppl use the same nick the passwords get messed up.
but it would be gr8 if someone could accomplish this task and i'm sure Admins of Hub Networks would find something like this somewhat usefull
QuoteOriginally posted by bastya_elvtars
U mean by triggering a regusers.dat reading process and if the users aint registered, ptokax adds them auto? Ok, gonna deal with that l8r...
no seperate files.
hub1 has addnewregfile1.txt.
when some1 regs himself in hub1 the nick/pw is written 2 this file.
every x minutes hub2 checks if this file is found, if yes it processes the file and adds the new users.
when done it deletes the file.
this works a lot faster as nothing has 2 be done if the file isn't found, no need 2 check if it's a old or a new user.
hub2 offcourse saves 2 addnewregfile2.txt and hub1 checks for that file.
plop
got an example Plop?
Can someone do this for me please?
anyone got a solution to this request?
pleeeease ;(
Hi,
I can try to make one. How many HUBs are you runnig on your PC ??? You want to refresh the reg file from which time ??
Best regards, nErBoS
Hi nerbos
Well i'm running 2 Hubs on my PC and i would like the refresh to be done at the same time or shortly after the the user gets registered to the hub if thats possible
otherwise a refresh intervall of 30 mins would be just fine.
Hi,
Try out this one...
--## REG HUBs BOT
--## Requested by Psycho_Chihuahua
--## Will only work with HUBs running in the same PC
--## Made by nErBoS
sBot = "RH-Bot"
sec = 1000
min = 60*sec
hour = 60*min
--## Configuration ##--
fReg = "RegisteredUsers.dat" -- Path of the RegisteredUsers.dat of the other HUB
iTime = 30*min -- Time that will refresh the register
--## END ##--
function Main()
SetTimer(iTime)
StartTimer()
end
function OnTimer()
if (readfrom(fReg) == nil) then
SendToOps(sBot, "The file with the register of the other HUB wasn't found.")
else
local count,time = 0,clock()
readfrom(fReg)
while 1 do
local sLine = read()
if (sLine == nil) then
time = clock() - time
time = format("%0.10f", time*1000)
SendToOps(sBot, "The reg file was refresh.")
SendToOps(sBot, "New entries: "..count..". Time taken: "..time.." seconds")
break
else
local s,e,nick,pass,level = strfind(sLine, "(.+)|(.+)|(%d+)")
if (nick ~= nil and CheckReg(nick) == 0) then
AddRegUser(nick, pass, tonumber(level))
count = count + 1
end
end
end
readfrom()
end
end
function CheckReg(nick)
local aux,profiles,usr
for aux, profiles in GetProfiles() do
for aux, usr in GetUsersByProfile(profiles) do
if (usr == nick) then
return 1
end
end
end
return 0
end
Best regards, nErBoS
cool .. been looking for something like that ..
but ..
[02:14:18] New entries: 363. Time taken: 38891.0000000000 seconds
[02:14:39] The reg file was refresh.
[02:14:39] New entries: 0. Time taken: 19891.0000000000 seconds
[02:15:00] The reg file was refresh.
[02:15:00] New entries: 0. Time taken: 19860.0000000000 seconds
[02:15:21] The reg file was refresh.
[02:15:21] New entries: 0. Time taken: 19687.0000000000 seconds
[02:15:42] The reg file was refresh.
[02:15:42] New entries: 0. Time taken: 20422.0000000000 seconds
[02:16:01] The reg file was refresh.
[02:16:01] New entries: 0. Time taken: 17953.0000000000 seconds
[02:16:21] The reg file was refresh.
[02:16:21] New entries: 0. Time taken: 18578.0000000001 seconds
[02:16:42] The reg file was refresh.
[02:16:42] New entries: 0. Time taken: 20812.0000000000 seconds
[02:17:03] The reg file was refresh.
[02:17:03] New entries: 0. Time taken: 20108.9999999999 seconds
[02:17:25] The reg file was refresh.
[02:17:25] New entries: 0. Time taken: 20468.9999999999 seconds
[02:17:45] The reg file was refresh.
[02:17:45] New entries: 0. Time taken: 18844.0000000001 seconds
and it won't stop ... keeps on trying to ad and add and add ..
i haven't changed the " iTime = 30*min "
Hi,
LOL, i have forgot to remove the 5 seconds i had to test it. Fixed the script above.
Best regards, nErBoS
;( ;( ;( it crashes my hub when i try to add a user ;( ;( ;(
i get an error box with a whole lot of writing and the reference that it cant write the RegisteredUsers.dat
I've testet with TD 4, TD 4.99 and 0.330 build 15.25 all with the same result.
in the Filepath to the file i have tried with \ and / and even //. Either i get..cant find file or it crashes/locks the hub untill the error box has been clicked away (buil 15.25 - with 4 and 4.99 the whole thing crashed)
Any Idea's?
Hi,
Well in my script i don't write anything in the file, because if i did it would crach like you said. You said that you tried to add a user, how ??? by a command or by hubsoftware i suppose. If you tryied to write in the file, off course it will fail and give you a error. Here is a example of how to catch the userregister file of the other HUB....
"C:\\WorkFolder\\Ptokax\\RegisteredUsers.dat"
Best regards, nErBoS
Doh, the only version i didn't try lol
I'll check it out just now
Well i tried that now to
i get a "what looks like linux or macintosh" error box containing the following:
Exeption 'EFCreate Error' in module PtokaX.exe at 000C0FFD
Cannot create file D:\hub\pto2\RegisteredUsers.dat
Using
QuoteD:\\hub\\pto2\\RegisteredUsers.dat
The funny thing though is that it still does the entry's to the file just that it locks up until the error messages are one by one clicked away. once per new user
that would be a solution, exept for that each hub uses slightly different scripts and has a different MOTD, so finding a way to it script wise is probably the only way
The funny thing is on 1 hub it works and on an identical (made from the same exe just in different folder) it fails in full
so one way it works and the other not, randomly
Hi,
Yes i have tested and it gaves me the same error, then i have tried another aproach, i copy the file to your script folder and will check from there, try this script...
--## REG HUBs BOT
--## Requested by Psycho_Chihuahua
--## Will only work with HUBs running in the same PC
--## Made by nErBoS
sBot = "RH-Bot"
sec = 1000
min = 60*sec
hour = 60*min
--## Configuration ##--
fReg = "RegisteredUsers.dat" -- Path of the RegisteredUsers.dat of the other HUB
iTime = 30*min -- Time that will refresh the register
--## END ##--
function Main()
SetTimer(iTime)
StartTimer()
end
function OnExit()
StopTimer()
end
function OnTimer()
execute("copy "..fReg)
if (readfrom("RegisteredUsers.dat") == nil) then
SendToOps(sBot, "The file with the register of the other HUB wasn't found.")
else
local count,time = 0,clock()
local handle = openfile ("RegisteredUsers.dat", "r+")
while 1 do
local sLine = read(handle)
if (sLine == nil) then
time = clock() - time
time = format("%0.10f", time*1000)
SendToOps(sBot, "The reg file was refresh.")
SendToOps(sBot, "New entries: "..count..". Time taken: "..time.." seconds")
break
else
local s,e,nick,pass,level = strfind(sLine, "(.+)|(.+)|(%d+)")
if (nick ~= nil and CheckReg(nick) == 0) then
AddRegUser(nick, pass, tonumber(level))
count = count + 1
end
end
end
closefile(handle)
remove("RegisteredUsers.dat")
end
end
function CheckReg(nick)
local aux,profiles,usr
for aux, profiles in GetProfiles() do
for aux, usr in GetUsersByProfile(profiles) do
if (usr == nick) then
return 1
end
end
end
return 0
end
Best regards, nErBoS
yeah gr8
It works fine now thnx Nerbos. Just 1 more thing - as long as the hub's running it's fine. when i shutdown the hub however i get a couple of error Boxes.
Got an Idea why? No other script running during tests.
Hi,
That happens to all versions of ptokax or just one in particular ?? If one in particular, which is it ??
Best regards, nErBoS
Well with 0.330 build 15.25 it happens already when i stop the hub
(http://psycho-chihuahua.ath.cx/images/ptokax/15.25.1.jpg)
(http://psycho-chihuahua.ath.cx/images/ptokax/15.25.2.jpg)
(http://psycho-chihuahua.ath.cx/images/ptokax/15.25.3.jpg)
with 0.326 TestDrive 4 only when i've stopped the hub and then want to close it.
(http://psycho-chihuahua.ath.cx/images/ptokax/td4.jpg)
otherwise the script does the job fine :D
Hi,
I have test it and didn't gave me any error.
Best regards, nErBoS
Unfortunetlly it gave me the same Errors...
both of the Versions.
this occurs when ptokax wants to write to an already used file.
so in other words would have to duplicate the RegisteredUsers.dat to a local directory and then read from copy into real Userfile which it does now.
And after processing that, erase the copy?
Or is it something else?
Hi,
The copy his made to your script folder then the script works from there. So i don't see why the error is coming up.
Best regards, nErBoS
I need to say my opinion in this script.
Why did you all not listen to plop...
Make 2 seperate files...
The RegisteredUsers.dat won't be updated until you restart the hub...
And with plop's idea you get no errors... :D
No harm to no one, great work nErBoS, but try out plop's idea.
Best Regards / NightLitch
Hi,
I have already made that, check the last script NL :))
Best regards, nErBoS