Site icon Hip-Hop Website Design and Development

Repeating login screen again, can’t go to index.php file. I cant fix this issue plz help me! [closed]

 <?php
        if(isset($_POST['login'])){
            $Username = $_POST['Username'];
            $Pass = $_POST['Pass'];

            $select = mysqli_query($conn,"SELECT * FROM login WHERE Username='$Username' AND Pass='$Pass'");
            $row = mysqli_fetch_array($select);

            if(is_array($row)){
                $_SESSION["Username"] = $row['Username'];
                $_SESSION["Pass"] = $row['Pass'];
                header("Location:index.php");
            }   else{
                echo '<script type = "text/javascript">';
                echo 'alert("Invalid Username or Password!")';
                echo 'window.location.href="login.php"';
                echo '</script>';
            }
        }
        if(isset($_SESSION["Username"])){
            header("Location:index.php");
        }


    ?>