Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include("inc/config.php");
- echo("<link href=\"../css/text.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />");
- $submit = $_POST['login'];
- $username = mysql_real_escape_string(strip_tags(htmlspecialchars($_POST['username'])));
- $password = md5($_POST['password']);
- if ($submit){
- if((!$username) || (!$password) || ($username=='') || ($password=='')){
- echo("<META http-equiv='refresh' content='4;URL=index.php'>");
- echo'<center>Please enter both - username and password!</center>';
- }
- $sql = mysql_query("SELECT * FROM `users` WHERE `username` = '".$username."' AND `password`= '".$password."'") OR die(mysql_error());
- $c = mysql_num_rows($sql);
- if($c > 0){
- $r = mysql_fetch_array($sql);
- $_SESSION['username'] = $r['username'];
- echo("<META http-equiv='refresh' content='4;URL=index.php'>");
- echo'<center>Login successfull!</center>';
- }else{
- echo("<META http-equiv='refresh' content='4;URL=index.php'>");
- echo "<center>You couldn't be logged in!</center>";
- }
- }
- ?>
Add Comment
Please, Sign In to add comment