Advertisement
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:wrong username + password combination
- 2:username is not found
- 3:username and/or password might be empty
- 4:username is not alphanumeric OR haven't got the correct length
- 5:password haven't got the correct length / or invalid characters
- */
- //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 exists
- if($functions->username_exists($username) == true){
- //username is alphanumeric and has the correct length(s)
- if($functions->check_password($password) == true){
- //password has the correct length
- if($functions->equal_password($username, $password) == true){
- //username and password is correct
- echo("Successfully Logged In");
- }else{
- //username and/or password combination is incorrect!
- header("Location: login.php?id=1");
- echo("Reloading...");
- }
- }else{
- //password haven't got the correct length or contains disallowed characters
- header("Location: login.php?id=5");
- echo("Reloading...");
- }
- }else{
- //username does not exist
- header("Location: login.php?id=2");
- echo("Reloading...");
- }
- }else{
- //username is not alphanumeric and/or haven't got the correct length(s)
- header("Location: login.php?id=4");
- echo("Reloading...");
- }
- }else{
- //username and/or password is not filled in.
- header("Location: login.php?id=3");
- echo("Reloading...");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement