Wednesday 5 October 2016

corelogin.php

<?php
include('config.php');

session_start();

if(isset($_REQUEST['btn_login']))
{
$user=$_REQUEST['txt_user'];
$pwd=$_REQUEST['txt_pwd'];

$_SESSION['user']=$user;

$res=mysql_query("select * from login where username='".$user."' and password='".$pwd."'");

if(isset($_SESSION['user']))
{
if(mysql_num_rows($res)==1)
{
echo "Success ".$_SESSION['user'];
header("location:emp.php");
}
else
{
echo "Invalid ".$user;
}
}
}
?>
<!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=utf-8" />
<title>Login Form</title>
<script type="text/javascript"  src="js/jquery.min.js"></script>
<script>
        $(document).ready(function()
{
c=0;
$("#pass").click(function()
{
              if(c==0)
 {
 document.getElementById("txt_pwd").setAttribute("type","text");
 c=1;
 }
 else
 { document.getElementById("txt_pwd").setAttribute("type","password");
 c=0;
 }
            });
         
        });
</script>


</head>

<body>

<form action="" method="post" name="Form1" enctype="multipart/form-data">

<fieldset id="Field1"><legend>Login</legend>
<table width="200" border="0" align="center">
  <caption align="center" style="font-family:Verdana, Geneva, sans-serif">Login</br></br></br></caption>
  <tr>
    <td>UserName:-</td>
    <td><input name="txt_user" type="text" placeholder="Username"  style="border:inset;" /></td>
  </tr>

  <tr>
    <td>Password:-</td>
    <td><input name="txt_pwd" id="txt_pwd" type="password" placeholder="Password" style="border:inset;"  /></td>
  </tr>
  <tr>
  </tr>
  <tr><td colspan="2">
    <input type="checkbox" id="pass"/>
  Show Password
  </tr>
  <tr align="right">
    <td colspan="2"><a href="forgetpassword.php"/>ForgotPassword</a> <a href="employee.php"/>SignUp</a> </td>
  </tr>
 
  <tr>
    <td align="center"><input name="btn_login" type="submit" value="Login"/></td>
 
    <td align="left"><input name="btn_reset" type="reset" value="Reset"/></td>
  </tr>
</table>
</fieldset>
</form>
</body>
</html>

No comments:

Post a Comment