| Current Path : /var/www/html/mmishra/mybp/ |
| Current File : /var/www/html/mmishra/mybp/printit.php |
<?php
include "functions.inc";
dbConnect();
$systemip = $_SERVER["REMOTE_ADDR"];
$pg = $_REQUEST["pg"];
if (!$pg) $pg = 'home';
//initialize session variables and session
session_start();
//authenticate signin
if ($_POST["submit"] == 'LOGIN') {
$user = $_POST["txtID"];
$pwd = $_POST["txtPWD"];
if (authenticate($user, $pwd) == 'OK') {
$sessionid = hash('ripemd160', $user.date("dmyHis").$systemip);
$_SESSION["user"] = "$user";
$_SESSION["sessionid"] = "$sessionid";
if ($user == 'anil' || $user == 'mmishra') $_SESSION["mybp"] = TRUE;
else $_SESSION["mybp"] = FALSE;
mysql_query("insert into el_session(user,sessionid,datelogin,systemip)
values('$user','$sessionid',now(),'$systemip')");
header("Location: index.php?pg=home");
}
}
//check session and session variables
if (isset($HTTP_SESSION_VARS['user'])) {
$user = $HTTP_SESSION_VARS['user'];
$sessionid = $HTTP_SESSION_VARS['sessionid'];
$mybp = $HTTP_SESSION_VARS['mybp'];
//check for singout signal
} else if ($pg == 'logout') {
//clear session information
mysql_query("update el_session set datelogout=now() where sessionid='$sessionid'");
//abondon session
session_unset();
session_destroy();
//reset session variables
$HTTP_SESSION_VARS['user'] = "";
$HTTP_SESSION_VARS['sessionid'] = "";
$HTTP_SESSION_VARS['mybp'] = "";
$user = "";
$sessionid = "";
$mybp = "";
//redirect to home page
header("Location: index.php?pg=home");
}
if (!$mybp == TRUE) $pg = 'home';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>MyBillPower</title>
<style type="text/css">
body {
font-size: 10pt;
font-weight: normal;
font-family: verdana;
}
h1 {
font-size: 16pt;
font-weight: bold;
}
h2 {
font-size: 14pt;
font-weight: bold;
}
h3 {
font-size: 13pt;
font-weight: bold;
}
td {
text-align: left;
font-size: 10pt;
font-weight: normal;
font-family: verdana;
}
/*@import "layout.css";*/
</style>
</head>
<body><center>
<table>
<tr><td><img src='images/logo4.jpg' width='80' height='80'></td>
<th>
<h1>Indian Institute of Information Technology Allahabad</h1>
<b>Devghat, Jhalwa, Allahabad-211012 (UP), India</b><br>
</th></tr>
<tr><th colspan='2'><hr><a href='/?pg=<?php echo $pg; ?>'><h3>Electrical Billing System</h3></a></th></tr>
<tr><td colspan='2'>
<form method="post" action="?pg=<?php echo $pg; ?>">
<?php
include "{$pg}.inc";
?>
</form>
<div align='right'>-- generated by MyBillPower (http://mybp.iiita.ac.in)</div>
</td></tr>
</table>
</center></body>
</html>