mIRC Home    About    Download    Register    News    Help

Print Thread
#52732 06/10/03 08:26 AM
Joined: Sep 2003
Posts: 21
S
soulz Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
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.
#52733 06/10/03 09:44 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Ini files would be the best way, I wrote a similar script earlier.
Code:
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
  }
}

#52734 06/10/03 02:32 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Quote:
if (!$1) && ($2) { echo You have a password, but no username. }

If $1 is not present, $2 can't be. wink

#52735 06/10/03 03:09 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
that looks ugly too...

Code:
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
#52736 06/10/03 03:29 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
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? smile

#52737 06/10/03 04:12 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
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
#52738 06/10/03 04:25 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
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.

#52739 06/10/03 05:17 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
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 blush


-KingTomato
#52740 06/10/03 05:26 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
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. smile

#52741 06/10/03 08:55 PM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
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

Link Copied to Clipboard