<?php 
session_start();
include('head.php'); 
if (isset($_POST['Submit']))
{
$username=$_POST['uname'];
$sql = "SELECT * FROM ojass_admin WHERE email='$_POST[uname]' AND kokoro='$_POST[pname]'";
     $result = $conn->query($sql);  
      //  $res = mysql_query($sql,$cons) or die(mysql_error()); 
      
      //  $result = mysql_num_rows($res);
//	if($result > 0){ 
	    	if ($result->num_rows > 0) {
	    while($rows = $result->fetch_assoc()) {
//	$rows=mysqli_fetch_array($result);
	$_SESSION['login_user']="$username";
	$_SESSION['id'] = $rows['user_id'];
	("Location:add_issues.php");
	die();
	}
	    	}
	else {$msg="Invalid User name or password";}
	
}
$conn->close();
?>	
				<div id="content">
                	<h2 class="title">Login</h2>
                    <br>
                    <table >
                    	<tr><td>
                        <div class="entry">
                        <form action="" method="post" role="form" class="contactForm">
                        <div class="form-group">
                            <input type="email" name="uname" class="form-control" id="name" placeholder="Email" data-rule="minlen:4" data-msg="Please enter at least 4 chars" autocomplete="off" />
                            <div class="validation"></div>
                        </div><br>
                        <div class="form-group">
                            <input type="password" class="form-control" name="pname" id="email" placeholder="Password" data-rule="email" data-msg="Please enter a valid email" />
                            <div class="validation"></div>
                        </div> <br>                   
                        <div class="text-center"><button type="submit" name="Submit" class="btn">Login</button></div>
                       
                    </form>
                    </div>
                </td></tr></table> <?php echo "<br>".$msg; ?>
					<div style="clear: both;">&nbsp;</div>
				</div>
				<!-- end #content -->
            
		</div>
	</div>
	<!-- end #page -->   
</div>

<?php include('footer.php'); ?>	