hello , i make account system
how to check if an account exists?
PHP Code:
if(self.typedvalutelogin.size > 3)
{
if=openfile(self.typedvalutelogin+".iwd","read");
...
}
hello , i make account system
how to check if an account exists?
PHP Code:
if(self.typedvalutelogin.size > 3)
{
if=openfile(self.typedvalutelogin+".iwd","read");
...
}
Last edited by malyczolg; 1st November 2013 at 13:00.
open it as read. if the fileheader is -1, file does not exist.
if the fileheader is different from -1, the file exists and you should close the file.
account created but i cant login msg: No such user
where is error ?
PHP Code:
if(response == "create")
{
name= self.typedvalutelogin;
f = openfile("account/" + name + ".czolg", "write");
fprintln(f, self.typedvalutelogin);
fprintln(f, self.typedvalutepassword);
closefile(f);
self iprintlnbold("account created name : " + self.typedvalutelogin + " / password : "+ self.typedvalutepassword);
}
if(response == "login")
{
self.writelogin = 0;
self.writepassword = 0;
if(self.typedvalutelogin.size > 3)
{
if(self.typedvalutelogin=="")
{
self iprintlnbold("Please specify a name");
continue;
}
if(self.typedvalutepassword=="")
{
self iprintlnbold("Please specify a password");
continue;
}
f=openfile("account/" + self.typedvalutelogin + ".czolg","read");
if(f==-1)
{
self iprintlnbold("No such user");
continue;
}
freadln(f);
if(fgetarg(f,1)!=self.typedvalutepassword)
{
self iprintlnbold("Invalid password");
closefile(f);
continue;
}
}
else if(self.typedvalutelogin.size <= 3)
{
self iprintlnbold("atleast 3 letters");
}
}
On localhost you can read files only from iwds.
randall thanks , i go test on dediced srv
@edit
this same on dediced srv
i cant login msg: No such user
need help
Last edited by malyczolg; 1st November 2013 at 14:06.
Not true. you can read them from raw files on a local server.
The only real drawback with local servers is that you can only use the files functions at callback_startgametype and once only. If you try to rotate to the next map with a local server, the file functions will fail.
As you can see, macyl is doing this reading from the _menus.gsc file, depending on user input, which means it is after serverstart.
OP: use some more debugging, like printing the filename the script will use etc.
beta login.menu
this same help.
PHP Code:
if(response == "create")
{
name= self.typedvalutelogin;
f = openfile("account/" + name + ".czolg", "write");
fprintln(f, self.typedvalutelogin);
fprintln(f, self.typedvalutepassword);
closefile(f);
self iprintlnbold("account created name : " + self.typedvalutelogin + " / password : "+ self.typedvalutepassword);
}
if(response == "login")
{
self.writelogin = 0;
self.writepassword = 0;
if(self.typedvalutelogin=="")
{
self iprintlnbold("Please specify a name");
continue;
}
else if(self.typedvalutepassword=="")
{
self iprintlnbold("Please specify a password");
continue;
}
else if(self.typedvalutelogin.size > 3)
{
f=openfile("account/" + self.typedvalutelogin + ".czolg","read");
if(fgetarg(f,0)!=self.typedvalutelogin)
{
self iprintlnbold("No such user");
continue;
}
freadln(f);
if(fgetarg(f,1)!=self.typedvalutepassword)
{
self iprintlnbold("Invalid password");
closefile(f);
continue;
}
}
else if(self.typedvalutelogin.size <= 3)
{
self iprintlnbold("atleast 3 letters");
}
}
is there actually a file created?