<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login</title>

<link href="login-box.css" rel="stylesheet" type="text/css" />
<script src="jquery-1.8.2.min.js"></script>
<script src="jquery-ui.js"></script>
<script src="jquery.validate.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#btn").click(function(){
//alert('ss');
		$("#frm").submit();
	});
});
</script>
</head>

<body>


<div style="padding: 100px 0 0 250px;">


<div id="login-box">

<H2>Login</H2>
Login to use SMS marketing.
<br />
<br />
<form name="frm" id="frm" action="" method="POST">
<?php if(isset($_GET['msg'])){ ?><p><b>Login Failed</b></p><?php } ?>
<div id="login-box-name" style="margin-top:20px;">Username:</div><div id="login-box-field" style="margin-top:20px;"><input name="u_name" class="form-login" title="Username" value="" size="30" maxlength="2048" /></div>
<div id="login-box-name">Password:</div><div id="login-box-field"><input name="pwd" type="password" class="form-login" title="Password" value="" size="30" maxlength="2048" /></div>
<br />
<span class="login-box-options"><input type="checkbox" name="1" value="1"> Remember Me <a href="#" style="margin-left:30px;">Forgot password?</a></span>
<br />
<br />
<a href="javascript:" id="btn"><img src="images/login-btn.png" width="103" height="42" style="margin-left:90px;" /></a>
</form>
</div>

</div>

</body>
</html>
<?php
ob_start();
session_set_cookie_params(10000000);
error_reporting(0);
session_start();
if(isset($_GET['lg']))
{
//print_r($_SESSION);
session_destroy();
}
if(isset($_POST['u_name']) && isset($_POST['pwd']))
{
include("config.php");
$u_name = $_POST['u_name'];
$u_pwd = $_POST['pwd'];
$data1 = mysql_query("SELECT * FROM `tbl_users` where u_name='".$u_name."' and u_pwd = '".$u_pwd."'");
if(mysql_num_rows($data1) == 1)
	{
		 while($info = mysql_fetch_array($data1))
			{
			
			$_SESSION['user'] = $info['u_name'];
			echo "<script>window.location='form.php'</script>";
			}
			
	}else
	{
	echo "<script>window.location='index.php?msg=e'</script>";
	}

//echo "ssss";
}

?>
