Login & Register

By SyntaxIRC on Jan 05, 2007

Features !status NICK

Info is stored in udata.ini properly, no bugs have been detected. If they part, change nick, or quit they'll be automatically logged out for security reasons.



IF I release another version it'll use $md5 converter to insert into the INI and when it uses READINI for the password, it'll convert to to proper format.




Place in REMOTES

on *:PART:#: {
if ($readini(udata.ini,$nick,logged) == Active) {
writeini udata.ini $nick logged Inactive
}
}
on *:NICK: {
if ($readini(udata.ini,$nick,logged) == Active) {
writeini udata.ini $nick logged Inactive
}
}
on *:QUIT: {
if ($readini(udata.ini,$nick,logged) == Active) {
writeini udata.ini $nick logged Inactive
}
}
on *:NOTICE:!register*:?: {
if ($readini(udata.ini,$nick,password) != $null) {
msg $nick Error! Account already exists!
halt
}
if (!$2) {
msg $nick Please specify a password!
halt
}
writeini udata.ini $nick password $2
writeini udata.ini $nick logged active
msg $nick You have successfully registered!
msg $nick Your password is $readini(udata.ini,$nick,password) - remember this for later use.
}
on *:NOTICE:!login*:?: {
if ($readini(udata.ini,$nick,password) == $null) {
msg $nick You have not registered!
halt
}
if (!$2) {
msg $nick Please enter a password!
halt
}
if ($readini(udata.ini,$nick,password) != $2) {
msg $nick You have entered an invalid password.
msg $nick This login has been logged.
halt
}
msg $nick Successfully logged in as $nick $+ .
writeini udata.ini $nick logged Active
timer 1 7200 msg $nick Session expired. Please relogin.
timer 1 1800 writeini udata.ini $nick logged Inactive
}
on *:TEXT:!status*:#: {
if ($readini(udata.ini,$2,password) == $null) {
msg $nick There is no user matching: $2 $+ !
halt
}
msg $chan Status for $2 $+ : $readini(udata.ini,$2,logged)
}

Comments

Sign in to comment.
Mpdreamz   -  Jan 06, 2007

\"IF I release another version it\'ll use $md5 converter to insert\"
$md5 converter ? lol

 Respond  
LIQUID_NiTrO   -  Jan 05, 2007

Ugh. What happened to the bracket formatting?
Also, there is no effective way for closing the client. For instance, if you needed to restart your computer, you would have to ensure that everyone was logged out of the bot first, or else manually change the values in udata.ini. Otherwise, when you opened the client running the script again, anyone who was logged on at the time you closed it would still be considered logged on, even if they had changed nicks or quit or whatever.
Hash tables are probably the easiest way to solve this problem since the data in a hash table is automatically cleared on exit unless explicitly saved. Therefore, even if the client crashes and the on EXIT event is not triggered, nobody will be logged in the next time you start the client.

 Respond  
Noutrious   -  Jan 05, 2007

Simple, but not good for those, who change they`re nicks much. I coded mine login system with IDs, when registering, the system gives user a ID, that he uses in login command - !login and by changing the nick to what he registered with, the !forgotid returns the nicks ID.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.