<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel ="shortcut icon" href="img/favicon.ico">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<link rel="stylesheet" href="css/kachafruit.css" />
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<title>Login Form</title>
<script type="text/javascript">
$(document).ready(function(){
   $("#btn_acceder").click(function(){
        username=$("#user_name").val();
        password=$("#password").val();
         $.ajax({
            type: "POST",
            url: "login.php",
            data: "username="+username+"&password="+password,
            success: function(html){
	        if(html=='false')
                {
	         $("#add_err").html("Usuario o contrase&ntilde;a incorrecto");
	       //$("#profile").html("<a href='logout.php' class='red' id='logout'>Logout</a>");
				// You can redirect to other page here....
                } else {
	            $("#login").fadeOut("normal");
                    $("#profile").html(html);
                    $(this).val(localStorage.getItem ($(this).attr('id')));
                    $.getScript ('hpedido.js');
					$.getScript ('hoferta.js');
                }
             } });
         return false;
    });

});


</script>

</head>
<body>
 
 <div id="profile">
 <div>
	
 
</body>
<?php 
session_save_path('tmp/cache');
session_start(); 
	
if(empty($_SESSION['user_name'])){?>
   <div data-role="page" id="login">
	<div data-role="header"  >
	<h1>Validacion Usuario </h1>
	</div>
	<div data-role="content">
	<div data-role="fieldcontain">
 
	<section id="content">
		<form  class="ui-body ui-body-a ui-corner-all"   >
			<h1>Kachafruit On Line</h1>
			<div>
				<input class="ui-input-text ui-body-c ui-corner-all ui-shadow-inset" type="text" placeholder="Usuario" required="" id="user_name"  name="user_name"/>
			</div>
			<div>
				<input type="password" placeholder="Contrase&ntilde;a" required="" class="ui-input-text ui-body-c ui-corner-all ui-shadow-inset" id="password"  name="password"/>
			</div>
		        <div class="err" id="add_err"></div>
			<div>
			<button value="submit-value" name="submit" data-theme="b" type="submit" id="btn_acceder"  class="ui-btn-hidden" aria-disabled="false">Acceder</button>
					 
			 
			</div>
		</form><!-- form -->
		<div class="button">
			
		</div><!-- button -->
	</section><!-- content -->
	 
	</div>
<?php
include ("footer.php");
?>
</div>
</div>
<?php }?>
<!-- container -->
</body>
</html>
