Advertisement
Guest User

Untitled

a guest
May 28th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.40 KB | None | 0 0
  1. <?php
  2.                        if(isset($_POST['submit-login']))
  3.                        {
  4.                            $login=$_POST['username'];
  5.                            $heslo=$_POST['password'];
  6.  
  7.                            //$login = stripslashes($login);
  8.                            /*$heslo = stripslashes($heslo);*/
  9.  
  10.                            $login = mysqli_real_escape_string($connection,$login);
  11.                            $heslo= mysqli_real_escape_string($connection,$heslo);
  12.  
  13.                            $heslo = sha1($heslo);
  14.  
  15.                            $sql = "select * from user where username='$login' and password='$heslo'";
  16.                            $dotaz=mysqli_query($connection,$sql);
  17.  
  18.                            $overeni = mysqli_num_rows($dotaz);
  19.                            $row = mysqli_fetch_array($dotaz);
  20.  
  21.                            if($overeni == 1) {
  22.                                session_start();
  23.                                $_SESSION['login'] = stripslashes($login);
  24.                                
  25.                                header("index.php");
  26.                                
  27.                            } else { ?>
  28.                                 <label class="label-chyba" for="username"> <h1> Login failed!</h1> </label>
  29.                                 <?php
  30.                            }
  31.                        }
  32.                        ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement