Payrole management program in Php With Full Source Code



Home.php

<?php session_start();

if(empty($_SESSION['username']))
{
header("location:PayroleLogin.php");


}
else
{

$name=$_SESSION['username'];
mysql_connect("localhost","student","") or die (mysql_error());
mysql_select_db("payrole") or die (mysql_error());

$result=mysql_query("select * from payrole_info  where Emp_username='$name' ") or die (mysql_error());
$row=mysql_fetch_array($result);



}
?>
<html>
<head>
<body>
<h2 align="center"> Welcome <?php echo $name; ?></h2>
<form method="post">
<table border="1" align="center">

<tr>
<td>Id Number:</td>
<td><?php echo $row[0] ?></td>
</tr>
<tr>
<td>First Name: </td>
<td><?php echo $row[1] ?> </td>
</tr>
<tr>
<td>Last Name: </td>
<td><?php echo $row[2] ?> </td>
</tr>
<tr>
<td>College Name: </td>
<td><?php echo $row[3] ?> </td>
</tr>
<tr>
<td>Photo Id: </td>
<td> <?php echo "<img src='$row[4]' height='100px' width='100px'>"; ?> </td>
</tr>
<tr>
<td>UserName: </td>
<td><?php echo $row[5] ?> </td>
</tr>
<tr>

<td colspan="2"><input type="submit" name="btnlogout" value="Log Out"></td>
</tr>

</table>
</form>
</body>
</head>
</html>

<?php
extract($_REQUEST);
if(isset($btnlogout))
{
unset($_SESSION['username']);
header("location:PayroleLogin.php");
}
?>



Payrole.php



<html>
<head>
<body>
<h2 align="center">Registration</h2>
<form method="post" enctype="multipart/form-data">
<table border="5" align="center">


<tr>
<td> Roll Number:</td>
<td> <input type="text" name="txtrollno" placeholder="Enter Roll Numbere"></td>

</tr>
<tr>
<td> First Name:</td>
<td> <input type="text" name="txtfname" placeholder="Enter First Name"></td>

</tr>

<tr>
<td>Last Name:</td>
<td> <input type="text" name="txtlname" placeholder="Enter Last Name"></td>

</tr>
<tr>
<td>College:</td>
<td> <input type="text" name="txtcname" placeholder="Enter College Name"></td>

</tr>
<tr>
<td>Upload Photo:</td>
<td> <input type="file" name="photoid"></td>

</tr>

<tr>
<td>Username:</td>
<td> <input type="text" name="txtuser" placeholder="Enter Username Name"></td>

</tr>
<tr>
<td>Password:</td>
<td> <input type="password" name="txtpass" placeholder="Enter Password"></td>

</tr>
<tr>
<td>Confirm Password:</td>
<td> <input type="password" name="txtcpass" placeholder="Enter Conform Password"></td>

</tr>

<tr>

<td colspan="2" align="center"> <input type="submit" name="btnsubmit" value="Submit"></td>

</tr>



</form>
</body>
</head>
</html>

<?php

extract($_REQUEST);

if(isset($btnsubmit))
{


mysql_connect("localhost","student","") or die (mysql_error());
mysql_select_db("payrole") or die (mysql_error());
move_uploaded_file($_FILES['photoid']['tmp_name'],$_FILES['photoid']['name']);
$img=$_FILES['photoid']['name'];

mysql_query("insert into payrole_info values('$txtrollno','$txtfname','$txtlname','$txtcname','$img','$txtuser','$txtpass','$txtcpass')")or die (mysql_error());

echo "Record Save Succesfully";

}


?>

Login.php


<?php session_start();?>
<html>
<head>
<body align="center">
<p align="center">Admin Login</p>
<form method="post">
<table border="1" align="center">

<tr>

<td> Username:</td>
<td><input type="text" name="txtuser" placeholder="Enter Username"> </td>

</tr>
<tr>

<td> Password:</td>
<td><input type="password" name="txtpass" placeholder="Enter Password"> </td>

</tr>

<tr>


<td colspan="2" align="center"><input type="submit" name="btnsubmit" value="Login"> </td>

</tr>





</table>
</form>
</body>
</head>
</html>





<?php

extract($_REQUEST);

if(isset($btnsubmit))
{


mysql_connect("localhost","student","") or die (mysql_error());
mysql_select_db("payrole") or die (mysql_error());
//mysql_query("insert into admin_info values('$txtuser','$txtpass')")or die (mysql_error());

//echo "Record Save Succesfully";



$result=mysql_query("select * from payrole_info where Emp_username='$txtuser' and Emp_password='$txtpass'");

if(mysql_num_rows($result)>0)
{
mysql_query("delete from payrole_info where Emp_username='$txtuser' ");

echo "data Delete";
$_SESSION['username']=$txtuser;


header("location: Home.php");


}
else
{
echo "Invalid user";

//header("Location:Update.php");

}

}

?>














Payrole management program in Php With Full Source Code Payrole management program in Php With Full Source Code Reviewed by Unknown on 23:50 Rating: 5

No comments:

Powered by Blogger.