(1)<html>
<head>
<link href="bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="jquery-1.10.2.min.js"> </script>
<script src="bootstrap.min.js"></script>
<script type="text/javascript" src="jquery.validate.min.js"></script>
</head>
<body>
<div class="modal-dialog">
<div class="modal-content col-md-8">
<div class="modal-header">
<h4 class="modal-title"><i class="icon-paragraph-justify2"></i> User Login</h4>
</div>
<form method="post" id="login_form">
<div class="modal-body with-padding">
<div class="form-group">
<div class="row">
<div class="col-sm-10">
<label>Username *</label>
<input type="text" id="username" name="username" class="form-control required">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-10">
<label>Password *</label>
<input type="password" id="password" name="password" class="form-control required" value="">
</div>
</div>
</div>
</div>
<div class="error" id="logerror"></div>
<!-- end Add popup -->
<div class="modal-footer">
<input type="hidden" name="id" value="" id="id">
<button type="submit" id="btn-login" class="btn btn-primary">Submit</button>
</div>
</form>
<script>
$(document).ready(function(){
$('#login_form').validate();
$(document).on('click','#btn-login',function(){
var url = "http://www.funmoviemasti.com/playquiz/login.php";
if($('#login_form').valid()){
$('#logerror').html('<img src="ajax.gif" align="absmiddle"> Please wait...');
$.ajax({
type: "POST",
url: url,
data: $("#login_form").serialize(), // serializes the form's elements.
success: function(data)
{
if(data==1) {
window.location.href = "main.html";
}
else $('#logerror').html('The email or password you entered is incorrect.');
$('#logerror').addClass("error");
}
});
}
return false;
});
});
</script>
</div>
</div>
</body>
</html>
<head>
<link href="bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="jquery-1.10.2.min.js"> </script>
<script src="bootstrap.min.js"></script>
<script type="text/javascript" src="jquery.validate.min.js"></script>
</head>
<body>
<div class="modal-dialog">
<div class="modal-content col-md-8">
<div class="modal-header">
<h4 class="modal-title"><i class="icon-paragraph-justify2"></i> User Login</h4>
</div>
<form method="post" id="login_form">
<div class="modal-body with-padding">
<div class="form-group">
<div class="row">
<div class="col-sm-10">
<label>Username *</label>
<input type="text" id="username" name="username" class="form-control required">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-10">
<label>Password *</label>
<input type="password" id="password" name="password" class="form-control required" value="">
</div>
</div>
</div>
</div>
<div class="error" id="logerror"></div>
<!-- end Add popup -->
<div class="modal-footer">
<input type="hidden" name="id" value="" id="id">
<button type="submit" id="btn-login" class="btn btn-primary">Submit</button>
</div>
</form>
<script>
$(document).ready(function(){
$('#login_form').validate();
$(document).on('click','#btn-login',function(){
var url = "http://www.funmoviemasti.com/playquiz/login.php";
if($('#login_form').valid()){
$('#logerror').html('<img src="ajax.gif" align="absmiddle"> Please wait...');
$.ajax({
type: "POST",
url: url,
data: $("#login_form").serialize(), // serializes the form's elements.
success: function(data)
{
if(data==1) {
window.location.href = "main.html";
}
else $('#logerror').html('The email or password you entered is incorrect.');
$('#logerror').addClass("error");
}
});
}
return false;
});
});
</script>
</div>
</div>
</body>
</html>
(2) then write code for "login.php" :
<?php
$username=$_POST['username'];
$password =$_POST['password'];
if($username=="om" && $password=="om")
{
echo 1;
}
else
{
echo 0;
}
?>
No comments:
Post a Comment