Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: checking username

  1. #1
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts

    checking username

    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 14:00.

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    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.

  3. #3
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts
    account created but i cant login msg: No such user
    where is error ?

    PHP Code:
    if(response == "create")
            {
                
    nameself.typedvalutelogin;
                
    openfile("account/" name ".czolg""write");
                
    fprintln(fself.typedvalutelogin);
                
    fprintln(fself.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");
                }
            } 

  4. #4
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    113
    Thanks
    10
    Thanked 74 Times in 45 Posts
    On localhost you can read files only from iwds.

  5. #5
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts
    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 15:06.

  6. #6
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by randall View Post
    On localhost you can read files only from iwds.
    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.

  7. #7
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    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.

  8. #8
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts
    beta login.menu
    Attached Thumbnails Attached Thumbnails shot0000.jpg  

  9. #9
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts
    this same help.

    PHP Code:
            if(response == "create")
            {
                
    nameself.typedvalutelogin;
                
    openfile("account/" name ".czolg""write");
                
    fprintln(fself.typedvalutelogin);
                
    fprintln(fself.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");
                }
            } 

  10. #10
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    is there actually a file created?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •