<?php
    session_start();     
    include('connection.php');  
    $lietotajvards = $_POST['lietotajvards'];  
    $parole = $_POST['parole'];
      
        $sql = "select id from users where username = '$lietotajvards' and password = '$parole'";  
        $result = mysqli_query($con, $sql); 
        $count = mysqli_num_rows($result);
        $row=$result->fetch_assoc();
        $id=$row['id'];
          
        if($count == 1){   
            $_SESSION['id']=$id;
                      

            header('Location: image-gallery.php');
            exit;

        }  
        else{  
            echo "<h1> Nepareizs login vai parole</h1>";  
            header("Location: index.html");
        }

?>  