Help ! (table)
Posted: Thu May 25, 2006 5:00 pm
Hello !
I'm starting writing a little chat server, but i've got some problem..
My first problem was here:
database(pfoo)\login = "pfoo"
database(ukw)\login = "pfoo"
Apparently, you can't use a string in a table ... so, when i:
Debug Database(pfoo)\login it returns "pfoo"
Debug Database(ukw)\login it returns "pfoo"
Purebasic return "pfoo" everytime...
I fixed this :
So, when I
Debug Database(pfoo)\login it return "pfoo"
Debug Database(ukw)\login it return "ukw"
But, when a user connect to the server, he has to log-in via the LOGIN <username> command.
when i type "LOGIN(chr10)pfoo(chr13):
login$ = StringField(StringField(PeekS(buffer), 2, Chr(10)), 1, Chr(13))
login$ contain "pfoo"
after, i need to check if the login exist in the database:
If (Database(login)\login = login$)
Here is the problem. I need to check in "database(pfoo)" which will call "database(0), but purebasic check "database(login)" ...
In TCL, this could be arranged with database([set login]) ...
Is there the same command in purebasic ?
Thx !
I'm starting writing a little chat server, but i've got some problem..
Code: Select all
Structure base
Login.s
Pass.s
EndStructure
Dim Database.base(1000)
Database(pfoo)\login = "pfoo"
Database(ukw)\login = "ukw"
database(pfoo)\login = "pfoo"
database(ukw)\login = "pfoo"
Apparently, you can't use a string in a table ... so, when i:
Debug Database(pfoo)\login it returns "pfoo"
Debug Database(ukw)\login it returns "pfoo"
Purebasic return "pfoo" everytime...
I fixed this :
Code: Select all
Structure base
Login.s
Pass.s
EndStructure
Dim Database.base(1000)
Global pfoo.w
Global ukw.w
pfoo = 0
ukw = 1
Database(0)\login = "pfoo"
Database(1)\login = "ukw"
Debug Database(pfoo)\login it return "pfoo"
Debug Database(ukw)\login it return "ukw"
But, when a user connect to the server, he has to log-in via the LOGIN <username> command.
when i type "LOGIN(chr10)pfoo(chr13):
login$ = StringField(StringField(PeekS(buffer), 2, Chr(10)), 1, Chr(13))
login$ contain "pfoo"
after, i need to check if the login exist in the database:
If (Database(login)\login = login$)
Here is the problem. I need to check in "database(pfoo)" which will call "database(0), but purebasic check "database(login)" ...
In TCL, this could be arranged with database([set login]) ...
Is there the same command in purebasic ?
Thx !