Jump to content
Sign in to follow this  
Chawaka

A simple yet useful edition for Registration scripts

Recommended Posts

So last night I came up with a good idea for registration scripts, applied it and thought I would share it with you.

This is a very simple yet useful modification that will tell players whether the registration system is activated, disabled, or they are already logged in. No more guessing!

 

So basically open up your registration script - look for the line that tells users if they cannot create a new account cause they are already logged in, or the registration system is disabled, which will probably look like this:

<?PHP
}
else {
  echo 'You are either already logged in, or the registration system is currently disabled.</div></div>';
}
?>

And replace it with:

<?PHP
    }
    else {
        echo 'You can not create a new account while being logged in.</div></div>';
    }
}
else {
    echo 'Registration system is currently disabled.</div></div>';
}
?>

And that's it.

Share this post


Link to post

wtf?

 

where is the ( if ) statement for registration disabled ?

 

are you so sure that every script have that?

Share this post


Link to post

There's already an if statement at the very top and beginning of the script that checks for the registration status, no need for more if statements otherwise we're validating a complete another form. Yeah I'm sure this should work for every script I tested it.

Share this post


Link to post

the else statement I contributed is for when the else statement above it isn't the right statement to be called since you are logged in,  the registration is enabled, and it shows error as though the registration is closed, this however slows down the server response - but now it checks if the register is set to true or false, if it's true and you are logged in, then it'll return true but with notification that you are logged in and that's what the else statement you're referring to is for, not returning false as that widely used registration script responds to it. If you take a look at the full PHP code of your registration you should get it right. It couldn't be simpler. This also stabilizes the PHP code, no more retrieving of invalid statements.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.