Login Page Code in PHP

<?php
define(‘HOST’,’host_name’);
  define(‘USER’,’user_name’);
  define(‘PASS’,’password’);
  define(‘DB’,’database_name’);
  $con = mysqli_connect(HOST,USER,PASS,DB);

    $username= $_GET[‘username’];
   
    //Creating sql query with where clause to get an specific employee
    $sql = “SELECT * FROM login WHERE username=’$username'”;
   
    //getting result
    $r = mysqli_query($con,$sql);
   
    //pushing result to an array
    $result = array();
    $row = mysqli_fetch_array($r);
    array_push($result,array(
            “username”=>$row[‘username’],
            “password”=>$row[‘password’]
        ));

    //displaying in json format
    echo json_encode(array(‘result’=>$result));
   
    mysqli_close($con);
?>

Regards,
Mayur Dighe
http://ImmortalDotNet.blogspot.com
http://MayurDighe.wordpress.com