|
Joined: Sep 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2003
Posts: 21 |
I wanna know what would be the best way to make a user list.. Would it be ini, txt, other ?
I am scripting a small bot so to speak to allow people auto ops auto voice, the ability to get invited into a chan amungst other options.. cause well I dont want to pay for a shell, and I have a machine on a highspeed line that has a good uptime that rarely ever goes down.. So I am using that as my shell/bot
Dejavue is only proof that dreams really do come true.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Ini files would be the best way, I wrote a similar script earlier.
on 1:TEXT:login*:?: {
if ($2) && ($3) {
if ($readini(Users.ini, Users, $2)) && ($3 == $gettok($readini(Users.ini, Users, $2),-1,45)) {
guser Users $2 8
}
else { .notice I could not log you in. }
}
}
au2 {
if (!$1) && (!$2) { echo No user or password specified. }
if ($1) && (!$2) { echo You have a username, but no password. }
if (!$1) && ($2) { echo You have a password, but no username. }
if ($1) && ($2) {
echo Success added!
echo Username: $1
echo Password: $2
writeini Users.ini Users $1 $2
}
}
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
if (!$1) && ($2) { echo You have a password, but no username. } If $1 is not present, $2 can't be.
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
that looks ugly too...
au2 {
if (!$2) { echo No username or password specified. }
else if (!$1) { echo You have no password. }
else {
echo Success added!
echo Username: $1
echo Password: $2
writeini Users.ini Users $1 $2
}
}
-KingTomato
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
Well, firstly I didn't write it so I don't know why you posted that to me. I believe also that you have the first two backwards, no?
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
Yes, i clicked the last reply, and was just making a general responce. Sorry.
Second, order doesnt matter... If the second isnt preset, or the first--still gett he same message. My pattern of thinking is go check from the last paremeter to the first. If your missing the last one, then alreayd right there you can halt processing. If you have the first, but then dont have the second, it took that much more power in parsing to check the first, then the second--rather than halting after one condition. I know, I know, one if statement--how much memory could that use. but hey, when you have seveal of em, it kinda make a difference. >:D
-KingTomato
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
I wasn't only talking about the order in which you have the lines.
if (!$2) { echo No username or password specified. } <- One of the two may be specified. elseif (!$1) { echo You have no password. } <- neither have been specified.
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
Hah, I see now... Was my cut and paste job.. >:D Yes, the echo's would be switched. My Bad
-KingTomato
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
Well, yes, but... /au2 username /au2 password For both of these, "if !$2" triggers - username OR password field is missing. /au2 Here, "if !$2" triggers again, however both username AND password field is missing. elseif !$1 { } ^ Although true, it is not triggered. i.e. Already been trapped above, because no $1 also means no $2.
|
|
|
|
Joined: Feb 2003
Posts: 810
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 810 |
Also, this must be a picky recommendation, but I would consider that any of the parameters could be 0 or even "$false" (hey, it's not impossible to have that as a password), so I wouldn't use the ! prefix for conditions there.
* cold edits his posts 24/7
|
|
|
|
|