Simple login

<?php
$con=mysqli_connect("localhost","root","root","oes2") or die(mysqli_error($con));
if(isset($_POST['submit']))
{
    extract($_POST);
    $q=mysqli_query($con,"select * from student where stdname='$username' and stdpassword='$password'") or die(mysqli_error($con));
    if(mysqli_num_rows($q)==1)
   
    {
    $row=mysqli_fetch_array($q);
   
    $_SESSION['uname_admin']=$row['admname'];

   
        echo"<script>";
        echo"alert('Login Successfully..');";
        echo"window.location.href='dashboard.php'";
        echo"</script>";
    }
    else
    {
        echo"<script>";
        echo"alert('Login Failed..Pls Try again..');";
        echo"</script>";
    }
}
?>

Comments

Popular posts from this blog

How to seperate character from string in php

How to Delete record using PHP Ajax

Uploads Only 10 files in month step by step