Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $error='';
- if (isset($_POST['submit'])) {
- if (empty($_POST['username']) || empty($_POST['password'])) {
- $error = "Username or Password is invalid";
- }
- else
- {
- $username=$_POST['username'];
- $password=$_POST['password'];
- $connection = mysql_connect("localhost", "root", "");
- $username = stripslashes($username);
- $password = stripslashes($password);
- $username = mysql_real_escape_string($username);
- $password = mysql_real_escape_string($password);
- $db = mysql_select_db("adatbazis", $connection);
- $query = mysql_query("select * from login where password='$password' AND username='$username'", $connection);
- $rows = mysql_num_rows($query);
- if ($rows == 1) {
- $_SESSION['login_user']=$username;
- header("location: profile.php");
- } else {
- $error = "Felhasznalonev vagy ";
- }
- mysql_close($connection);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement