SHARE
TWEET

login.php

virabhairava Oct 4th, 2017 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     session_start();
  3.     require 'dbh.php';
  4.  
  5.     $username = $conn->escape_string($_POST['username']);
  6.     $pass = $conn->escape_string($_POST['password']);
  7.     $sql = "SELECT * FROM korisnici where imeKorisnika = '$username'";
  8.     $resault = $conn->query($sql);
  9.     if ($resault->num_rows > 0) {
  10.         $user = $resault->fetch_assoc();
  11.         if ($username == $user['imeKorisnika'] && $pass == $user['sifraKorisnika']) {
  12.             $_SESSION['id'] = $user['id'];
  13.             $_SESSION['logovan'] = 1;
  14.             header("Location: ../logovan.php");
  15.         }
  16.         else{
  17.             echo"Sifra ili username nisu ispravni";
  18.         }
  19.     }
  20.     else{
  21.         $_SESSION['message'] = "Nema takvih korisnika";
  22.         header("Location: ../index.php");
  23.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top