Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //LOGGING IN-USER\\
- if(isset($_POST['action']) == "login"){
- //Defining special variables (username and password)
- $username = strtolower(mysql_real_escape_string($_POST['username']));
- $password = mysql_real_escape_string($_POST['password']);
- //Getting Information
- $sql = mysql_query("SELECT * FROM `user` WHERE `Id`='$username'") or die(mysql_error());
- $sqlly = mysql_fetch_assoc($sql);
- $dbusername = strtolower($sqlly['Id']);
- $dbpassword = $sqlly['Password'];
- //Starting Verification Process
- if(!$password || !$username){die("<script>alert('Fill in all fields'); history.back();</script>");}
- if(!eregi("^[a-zA-Z0-9]*$", mysql_real_escape_string($_POST['username']))){
- die("<script>alert('Username must be alpha-numeric'); history.back();</script>");
- }
- if($username != $dbusername){die("<script>alert('Username not found'); history.back();</script>");}
- if($password != $dbpassword){die("<script>alert('Incorrect password'); history.back();</script>");}
- if (strlen($password)>16 || strlen($password)<4){die("<script>alert('Password must be between 4~16 characters'); history.back();</script>");}
- if (strlen($username)>16 || strlen($username)<4){die("<script>alert('Username must be between 4~16 characters'); history.back();</script>");}
- session_start();
- $_SESSION['user']=$username;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement