Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require("functions.class.php");
- $functions = new functions;
- @$username = strip_tags($_POST['username']);
- @$password = strip_tags($_POST['password']);
- /*WARNING LIST
- 1:Username and/or password might be empty
- 2:Username is not alphanumeric OR haven't got the correct length
- 3:Password haven't got the correct length, or does not contact a-z A-Z 0-9 ! @ # $ % ^ & *
- 4:Username already in use
- 5:Registration Failed
- */
- //echo($functions->username_exists("admin"));
- //echo($functions->receive_password("admin"));
- //echo($functions->receive_salt("admin"));
- //echo($functions->equal_password("admin","password"));
- if(!empty($username) && !empty($password)){
- //username and password is filled in.
- if($functions->check_username($username) == true){
- //username is valid
- if($functions->check_password($password) == true){
- //password is valid
- if($functions->username_exists($username) == false){
- //remember this must be FALSE else the username already exists! <this is pretty much the only function that may return false in the register
- //username does not exist
- if($functions->register($username, $password) == true){
- //username and password is registered
- echo('<strong>Successfully Registered!</strong><br />You can now <a href="login.php">login</a>!');
- }else{
- //username and password could not be registered.
- header("Location: register.php?id=5");
- echo("Reloading...");
- }
- }else{
- //username exists
- header("Location: register.php?id=4");
- echo("Reloading...");
- }
- }else{
- //password is invalid
- header("Location: register.php?id=3");
- echo("Reloading...");
- }
- }else{
- //username is invalid
- header("Location: register.php?id=2");
- echo("Reloading...");
- }
- }else{
- header("Location: register.php?id=1");
- echo("Reloading...");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment