
PK 
<?php
//error_reporting(E_ALL);
//ini_set('display_errors','off');
session_start();
require_once 'common/common.php';
include "connexion.php";
$errorMessage = '';
if (isset($_POST['username']) && isset($_POST['password']))
{
if($_POST['city']=="amritser")
{
//mysql_connect("localhost","pcfcindi_lg2012","XEgzF{X^e]~i") or die('Could not connect to Server');
//mysql_select_db("pcfcindi_old2012") or die('database not found');
}
else if($_POST['city']=="ludhiana")
{
//mysql_connect("localhost","pcfcindi_lg2012","XEgzF{X^e]~i") or die('Could not connect to Server');
//mysql_select_db("pcfcindi_old2012") or die('database not found');
}
else if($_POST['city']=="login_account")
{
//mysql_connect("localhost","pcfcindi_lg2012","XEgzF{X^e]~i") or die('Could not connect to Server');
//mysql_select_db("pcfcindi_old2012") or die('database not found');
}
$tname=$_POST['username'];
$Password1=md5($_POST['password']);
// check if the user id and password combination exist in database
$sql= "SELECT
user,
id,
type
FROM
amembs
WHERE
user='$tname'
AND
pass=('$Password1')
AND
type='".$_POST['city']."'";
$result = mysql_query($sql)
or die('Query failed. ' . mysql_error());
if (mysql_num_rows($result) == 1)
{
// the user id and password match,
// set the session
$idc=mysql_fetch_array($result);
//account session city is changed
if($_POST['city']=="login_account")
{
$_SESSION['city']='amritser';
}
else
{
$_SESSION['city'] = $_POST['city'];
}
//account session city is changed
$_SESSION['user_id'] = $idc['id'];
$_SESSION['str_sessid']="ZG93bmxvYWRmaWxlc2hhc2gvMQ";
//last login update in amembs table.
$din=date('D, d M Y + H:i:s a');
$sql = "UPDATE amembs
SET lastlogin='$din'
WHERE user = '$tname'
AND pass =('$Password1')";
$result = mysql_query($sql)
or die('Query failed. ' . mysql_error());
// after login we move to the main page
if($idc['type']=='accountant')
{
if($_POST['city']=='login_account')
{
header('Location: accounts/index.php');
exit;
}
else
{
echo $errorMessage = '<span style="color:red;">Sorry, wrong username or password</span>';
}
}
else
{
//$errorMessage = '<span style="color:red;">Sorry, wrong username or password</span>';
if($_POST['city']!='login_account')
{
header('Location: members_area.php');
exit;
}
else
{
$errorMessage = '<span style="color:red;">Sorry, wrong username or password</span>';
}
}
}
else
{
$errorMessage = '<span style="color:red;">Sorry, wrong username or password</span>';
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>PEST CONTROL AND FUMIGATION COMPANY - MEMBERS LOGIN</title>
<link rel="stylesheet" type="text/css" href="mycss.css" media="screen" title="Dalvay"/>
<link rel="stylesheet" type="text/css" href="content.css" media="screen" />
<script language="JavaScript" type="text/javascript" src="common/jquery-1.3.2.min.js"></script>
<script language="JavaScript" type="text/javascript">
$(document).ready(function(){
$('#submit').click(function(){
if($('#username').val()=="")
{
alert("Please Enter Valid User Name.");
$('#username').focus();
return false;
}
if($('#password').val()=="")
{
alert("Please Enter Password");
$('#password').focus();
return false;
}
});
});
</script>
<style type="text/css">
body
{
background-color: #f6f6f6;
}
/* Portal page box */
.portal-box-header
{
min-height: 20px;
padding: 30px 30px 0 30px;
}
.portal-box-header h1
{
border: 0;
font-weight: bold;
color: #bd1d01;
font-size: 200%;
margin: 0;
margin-right: 300px;
}
.portal-box-contents
{
background: url(portal-box-bottom.png) no-repeat bottom left;
padding: 40px 30px 40px 30px;
}
.set
{
margin-top: 10px;
width: 280px;
float: right;
}
.set2
{
margin-right: 25px;
}
.portal-box-interior
{
width: 760px;
}
.corner-box
{
width: 400px;
margin-left: 15px;
}
.ltr1
{
margin-left: 250px;
}
/* Footer */
.footer {
border: none;
width: 720px;
margin-left:150px;
margin-top:0px;
font-size: 80%;
color: #AAA;
}
/* Page specific styles */
#central .portal-box-interior
{
background: url(central-header.jpg) top left no-repeat;
}
#central .portal-box-header
{
padding-top: 20px;
padding-bottom: 20px;
min-height: 120px;
margin-bottom: 55px;
}
.portal-box1
{
width: 744px;
color: #5F6775;
margin-left:150px;
margin-top:100px;
background: #fff url(portal-box-sides.png) repeat-y;
}
.portal-page
{
margin-top: -50px;
}
</style>
</head>
<body id="central" class="portal-page">
<div class="portal-box1">
<div class="portal-box-interior">
<div class="portal-box-header">
<h1>
Members Login...<br>F. Year: 2022-23
</h1>
</div>
<div class="set"><div class="set2"><img src="bulk_mid.jpg" align="right" height="190" ></div></div>
<div class="portal-box-contents">
<form action="" method="post">
<?php echo $errorMessage; ?>
<div class="corner-box">
<strong>Username </strong>
<input type="text" name="username" id="username" style="width: 175px;" maxlength="30">
<br><br>
<strong>Password </strong>
<input type="password" name="password" id="password" style="width: 175px;" maxlength="30">
<br><br>
<strong>Branch </strong>
<select name="city" style="width: 175px;">
<option value="amritser">Amritsar</option>
<option value="ludhiana">Ludhiana</option>
</select><br><br>
<!--<strong>Section </strong>
<select name="login_section" style="width: 175px;">
<option value="">Normal</option>
<option value="login_account">Account</option>
</select>
--><br/><br/>
</div>
<center>
<span class="portal-button">
<input type="submit" class="amo-submit" id='submit' onClick="return validate();" value=" Login into Members Area >>">
</span>
</center>
</form>
</div> <!-- end .portal-box-contents -->
</div> <!-- end .portal-box-interior -->
</div> <!-- end .portal-box -->
<!-- start #footer -->
<div class="footer">
<p class="ltr1">copyrights © 2022-23 Anibs Business Solutions</p>
</div>
<!-- end #footer -->
</body>
</html>


PK 99