The online racing simulator
[Solved] Logincode HELP
i think i might have a bug some where could some one help? it all works but the admin pass part any idea?

<?php 
                                           
CASE "!login":
                                   IF( 
UserInGroup"register" ,"Registered" ) == )
            
THEN
                     
IF( UserInGroup"admin",$userName ) == || UserInGroup"beta",$userName ) == 1)
        
THEN
                               openPrivTextButton
"LUser1",50,25,25,15,5,96,"Username","Username",50,LUser);
                
openPrivTextButton"LPass1",50,51,25,15,5,96,"Password","Password",30,LPass);
                
openPrivTextButton"LAPass",50,76,25,15,5,96,"Admin Password","Admin Password",30,LAPass);
                   
openPrivButton"Login",50,101,25,15,5,-1,96,"Login",Login);
                              ELSE
                              
openPrivTextButton"LUser",50,25,25,15,5,96,"Username","Username",30,LUser);
                
openPrivTextButton"LPass",50,51,25,15,5,96,"Password","Password",30,LPass);
                  
openPrivButton"Login",50,101,25,15,5,-1,96,"Login",Login);
                              ENDIF
          Else
                      
privMsg"^1Your Not Registered");
                      ENDIF
                      BREAK;
            
?>


<?php 
                               
CASE "!register":
                                   IF( 
UserInGroup"register" ,"Registered" ) != )
            
THEN
                               openPrivTextButton
"RUser",50,25,25,15,5,96,"Username","Username",30,User);
                
openPrivTextButton"RPass",50,51,25,15,5,96,"Password","Password",30,Pass);
                              
MoveUserToGroup"register" "Registered" );
          
SaveGroupToFile$userName"./../user/registered/" $userName ".txt" );
          Else
                      
privMsg"^1Already Registered");
                      ENDIF
                      BREAK;
            
?>


<?php 
Sub User
$User )
          
ClosePrivButton("RUser");
          
$userName GetCurrentPlayerVar("UserName");
                    
MoveUserToGroup"register"  "UserName = " $User );
          
SaveGroupToFile"register"  "./../user/registered/" $userName ".txt" );
          
RemoveUserFromGroup"register"  "UserName = " $User );
EndSub 
    
        Sub Pass
$Pass )
          
ClosePrivButton("RPass");
          
$userName GetCurrentPlayerVar("UserName");
                    
MoveUserToGroup"register"  "Password = " $Pass );
          
SaveGroupToFile"register"  "./../user/registered/" $userName ".txt" );
          
RemoveUserFromGroup"register" "Password = " $Pass );
EndSub

Sub LUser
$LUser )
        
GlobalVar $LUser1;
    
$LUser1 $LUser;
EndSub
    
        Sub LPass
$LPass )
        
GlobalVar $LPass1;
    
$LPass1 $LPass;
EndSub    
        Sub LAPass
$LAPass )
        
GlobalVar $LAPass1;
    
$LPass1 $LAPass;

EndSub

        Sub Login
$KeyFlags,$id )
                
$userName GetCurrentPlayerVar("UserName");
        
UserGroupFromFile"register""./../user/registered/" $userName ".txt" );
            IF( 
UserInGroup"register" "UserName = " $LUser1 ) == && UserInGroup"register" "Password = " $LPass1 ) == )
            
THEN
                           
IF( $LAPass1 == $AdminPass || $LAPass1 == $BetaPass )
      
THEN
        privMsg
"^2Thank you for logging in Admin");
        
MoveUserToGroup"tempadmin",$userName );
      ELSE
      IF( 
$LAPass1 == "" )
      
THEN
                                        closePrivButton
("LUser1");
                                  
closePrivButton("LPass1");
                           
privMsg"^2Thank You For Logging In"  );
                                        
closePrivButton("LAPass");
                              
closePrivButton("Login");
      ELSE
        
privMsg"^1Incorrect Admin Password");
      ENDIF
      ENDIF
            ELSE
               
privMsg"Incorrect UserName And/Or Password"  );
            ENDIF
EndSub
?>


#2 - Krayy
Oh, where to begin....

Firstly you are calling the UserInGroup function in both the !register and !login commands with no username. Instead of calling it like:
UserInGroup( "register" ,"Registered" )

you should probably be calling it like:
UserInGroup( "register",$UserName )

Next, in the LUser, LPass and LAPass subs, you are setting a global var to store the login/passwords which is a bit of a no-no in that anyone who runs the !login command while another is doing it might overwriet those values before they are finished with. If I were you, I would use the SetUserStoredValue and GetUserStoredValue functions to store those values in the local databse for easy retrieval later on. They can be cleared when the user logs out or disconnects, or leave them there for future reference. In fact, I would be inclined to stire them there permanently rather than trying to create a usergroup for passwords and writing it out to a text file. Syntax for those functions are:
SetUserStoredValue(LUser, $LUser);
SetUserStoredValue(LPass, $LPass);

Then they are in the storedvalues.dbs database and will be easily retreivable using:
$LUser = GetUserStoredValue(LUser);
$LPass = GetUserStoredValue(LPass);

PS: What is the LAPass setting meant to do?
Quote from Krayy :Oh, where to begin....

Firstly you are calling the UserInGroup function in both the !register and !login commands with no username. Instead of calling it like:
UserInGroup( "register" ,"Registered" )

you should probably be calling it like:
UserInGroup( "register",$UserName )

Next, in the LUser, LPass and LAPass subs, you are setting a global var to store the login/passwords which is a bit of a no-no in that anyone who runs the !login command while another is doing it might overwriet those values before they are finished with. If I were you, I would use the SetUserStoredValue and GetUserStoredValue functions to store those values in the local databse for easy retrieval later on. They can be cleared when the user logs out or disconnects, or leave them there for future reference. In fact, I would be inclined to stire them there permanently rather than trying to create a usergroup for passwords and writing it out to a text file. Syntax for those functions are:
SetUserStoredValue(LUser, $LUser);
SetUserStoredValue(LPass, $LPass);

Then they are in the storedvalues.dbs database and will be easily retreivable using:
$LUser = GetUserStoredValue(LUser);
$LPass = GetUserStoredValue(LPass);

PS: What is the LAPass setting meant to do?

well could u do it for me? im abit confused with that stuff

and my buf is in the admin part every thing else works and im also adding a part when 2 people cant login at the same time
#4 - Krayy
I'll get you started, but te tack that I will take is slightly to the left of yours.

Firstly, you won't need to store the username, as I said in the other thread, as the LFS username is unique o each installation and if someone is that desperate to try and hack an LFS server, then they have more time than good sense.

The admin password is already handled in the admin usergroup functions so I can't see why you want to authenticate that twice.

The user password is another matter, but the way which it should be initiated would be more logical to call the login function from within the OnConnect function. That way, you're making it compulsory to log in each time you connect. The code below will store the user password in the storedvalues database, but I will leave it to you to figure out how to get it in there.

So to summarise....put a call to OnConnect_Login at the end of the OnConnect function in the main lapper file. This will allow the user to enter his/her password and store it in the storedvalues database in the LPassTemp entry. When you click the Login button, it will check that the LPassTemp value is the same as the store LPass value. Then you're in.

That should be enough to get you started

Sub OnConnect_Login()
$UserName = GetCurrentPlayerVar("UserName");
IF ( UserInGroup( "register", $UserName ) == 1 )
THEN
openPrivTextButton( "LPass1",50,51,25,15,5,96,"Password","Password",30,LPass);
openPrivButton( "Login",50,101,25,15,5,-1,96,"Login",Login);
ELSE
privMsg( "^1You're Not Registered");
ENDIF
EndSub

Sub LPass( $LPass )
SetUserStoredValue(LPassTemp, $LPass);
TextPrivButton( "Login","^3***********" );
EndSub

Sub Login( $KeyFlags,$id )
$userName = GetCurrentPlayerVar("UserName");
IF ( GetUserStoredValue(LPass) == GetUserStoredValue(LPassTemp) )
THEN
closePrivButton("LUser1");
closePrivButton("LPass1");
privMsg( "^2Thank You For Logging In" );
closePrivButton("LAPass");
closePrivButton("Login");
ELSE
privMsg( "Incorrect Password" );
ENDIF
EndSub

ok but how do i set up store values aka register?

like what is the thing i dont need u to do the whole thing just that 1 line
#6 - Krayy
Quote from Fire_optikz001 :ok but how do i set up store values aka register?

like what is the thing i dont need u to do the whole thing just that 1 line

UserGroupFromFile( "register", "./registered.txt" );
Quote from Krayy :UserGroupFromFile( "register", "./registered.txt" );

ye but how do i store the values :S
Quote from Fire_optikz001 :ye but how do i store the values :S

Hi,
You can use this to write and read to the StoredValue database.

(example)
SetUserStoredValue( "LPass" , $LPass); #write to StoredValue database
getUserStoredValue( "LPass," ); #read from StoredValue database

Works the same in the point system.

[COLOR=blue] # read from database and store in playerVar[/COLOR]
[COLOR=orange]Line 59[/COLOR] SetCurrentPlayerVar( "ps_points_total",getUserStoredValue( "ps_points_total" ) );
[COLOR=blue] # write the value from playervar into the database[/COLOR]
[COLOR=orange]Line 162[/COLOR] setUserStoredValue( "ps_points_total", GetCurrentPlayerVar( "ps_points_total" ) );

im gonna make something new
if some one was nice could they post how this actually should be done :|

cause there would have to be some sort of prvention sys from people using other peopls usernames and pass words
-
(Grigg94) DELETED by Grigg94
Quote from Tim NL :

getUserStoredValue( "LPass[COLOR="Red"][B],[/B][/COLOR]" ); [COLOR=blue]#read from StoredValue database[/COLOR]


Required here is the comma?
nope is typo

must be
getUserStoredValue( "LPass,$LPass" ); #read from StoredValue database
How do i set up this login/register code?
Quote from kepp1313 :How do i set up this login/register code?

Look for this event: Event OnMSO( $userName, $text ) # Player event
Then look for this: SWITCH( $command )
Add a new CASE followed by the command you want to register, something like:


CASE "!register":
privMsg("You are now in the registration code");
BREAK;

Maybe you can add yourself to my insim? It will be easier
Sorry for the second article!
insim is my first article!
Quote from kepp1313 :Maybe you can add yourself to my insim? It will be easier

I have no knowledge of programming, so no clue what to do with the files you included.
All I know is that what you want (registration + login) can easily be written within LFS Lapper.
In fact, all things needed for a Cruise insim, can be done within Lapper.
Maybe you have insim witch login / register system?
Quote from kepp1313 :Maybe you have insim witch login / register system?

You only need a !login and !register system if the insim is mentioned to be used in S2 Cracked Servers.

I'm afraid we do not support that here.
Quote from kepp1313 :Maybe you have insim witch login / register system?

I don't have that, but I think I can easily create that in Lapper.
Will give it a shot and report back to you.
Login & Registration system
Right, after 2,5 hours of coding and testing, I can present you the Login & Registration system version 1.01
Which has the following features:

- Register account with an accountname and a password
- Check if user already made an account, if so an automatic transfer to login screen
- After account has been succesfuly registered, automatic transfer to login screen
- Login screen with check on both accountname and password
- After 3 false attempts to login, user is kicked from the server

Installation instructions:

Download "reg_system.txt"
Rename "reg_system.txt" to "reg_system.lpr"
Place "reg_system.lpr" in your "bin\includes" folder of your LFS Lapper installation
Open "addonsused.lpr" and add: include( "./reg_system.lpr");
Attached images
login_register_1.png
login_register_2.png
login_register_3.png
Attached files
reg_system.txt - 8.2 KB - 380 views
This whole thing is a terrible idea. You already have a user name, and you should never send passwords in clear text. You're going too have to do that because there is no way to obfuscate a password in the InSim protocol, outside of gaming through a VPN connection to your server and having all of your other clients as well.

Basically, this is only useful in one situation. When you have clients that are account hoping because they are getting banned for hacking / on cracked server and need a fresh account to get into the game.
Does this system worked to insim c + +?
Quote from kepp1313 :Does this system worked to insim c + +?

No, it runs within LFS Lapper.
So you need to download, install and setup LFS Lapper and then follow the steps I described in my previous posting.
Can you make for me?
1
This thread is closed

FGED GREDG RDFGDR GSFDG