Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require("general.php");
- $username = $_POST['username'];
- $password = $_POST['password'];
- if($username != "" && $password != "" )
- {
- if(substr($username,0,6) == "Coder_") // A Coder Logging in
- {
- $username = substr($username,6);
- $tabel = "coders";
- }
- else // Regular Costumer
- {
- $tabel = "costumers";
- }
- $q = mysql_query("SELECT * FROM `".$tabel."` WHERE login ='".mysql_escape_string($username)."'");
- $person = mysql_fetch_array($q);
- if(md5($password) == $person['password']) // Correct Password
- {
- if($tabel == "coders")
- {
- $_SESSION['id'] = 0;
- $_SESSION['coder'] = $person['id'];
- }
- else
- {
- $_SESSION['id'] = $person['id'];
- }
- //Redirection to Index.php
- header("Location: index.php", true, 306);
- }
- else{ echo("<h2>Username or Password is wrong!</h2>"); }
- }
- else{ echo("<h2>Username or Password is Empty!</h2>"); }
- ?>
Add Comment
Please, Sign In to add comment