<?php
session_start();
include ("includes/database.php");
include ("includes/setting.php");
include ("includes/clean.php");
?>

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title><?php echo $tajuk; ?></title>

    <!-- Bootstrap Core CSS -->
    <link href="vendor/bootstrap/css/bootstrap.min(2).css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

    <div class="container">
        <div class="row">
            <div class="col-md-4 col-md-offset-4">
                <div class="login-panel panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title"><?php echo $tajuk; ?></h3>
                         <p><img src="images/social.jpg" width="325" height="325"></p>
                    </div>
                    <div class="panel-body">
                    
<?php
if (isset($_POST["username"]))
  {
	
$username=($_POST["username"]);
$pwd=($_POST["password"]);


//step 1 - check record exist

$dataWujud=mysqli_query($newcon,"select * from lawyer where lawyer_username='$username'");  //sql query
$showData=mysqli_fetch_array($dataWujud); //put data into array
$bil_rekod=mysqli_num_rows($dataWujud); //check number of records


if ($bil_rekod==0)
{$msg="<div class='callout callout-danger'><h4>Login Status</h4> <p>Wrong username or password!. Please try again </p></div>";}

elseif ($showData['lawyer_password']!=md5($pwd)) //check password matching
{$msg="<div class='callout callout-danger'><h4>Login Status</h4> <p>Wrong username or password!. Please try again </p></div>";}

else
{
	
//set session
$_SESSION["username"]=$showData['lawyer_username'];
$_SESSION["status"]=$showData['status'];
header ("location: lawyer.php");

}
echo $msg;
  }
?>                    
  
  <form role="form" method="post">
                            <fieldset>
                                <div class="form-group">
                                    <input class="form-control" placeholder="Username" name="username" type="text" autofocus>
                                </div>
                                <div class="form-group">
                                    <input class="form-control" placeholder="Password" name="password" type="password" value="">
                                </div>
                               
                                <!-- Change this to a button or input when using this as a form -->
                                <button href="index.html" class="btn btn-lg btn-success btn-block">Login</button>
                            </fieldset>
                        </form>
                        
                        
              <br>
                        <br>
                        
                    <a href="registerlawyer.php" class="text-center">Register a new membership</a><br>
                    </p>
                        <p>
						
						 <span class="fa fa-user"></span> <?php echo $developer; ?><br>
                        <span class="fa fa-envelope-o "></span> <?php echo $edev; ?><br>
                        <span class="fa fa-phone"></span> <?php echo $pdev; ?><br>
                        <span class="fa glyphicon-copyright-mark"></span> <?php echo $cright; ?><br>           
                        
                        
                    </div>
                </div>
            </div>
        </div>
    </div>                  
                    
                    
                    
                    
                    
                    
                    
                   
                        
    <!-- Bootstrap core JavaScript -->
    <script src="vendor/jquery/jquery.min.js"></script>
    <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

    <!-- Plugin JavaScript -->
    <script src="vendor/jquery-easing/jquery.easing.min.js"></script>

    <!-- Custom scripts for this template -->
    <script src="js/grayscale.min.js"></script>

</body>

</html>
