PK

ADDRLIN : /home/anibklip/ulpc.in/bkp2020-21/
FLL :
Current File : //home/anibklip/ulpc.in/bkp2020-21/login2.php

<?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>';

				header("Location: index.php?errorMessage=$errorMessage");

				exit;

			}

		 }	

	}else{

		$errorMessage = '<span style="color:red;">Sorry, wrong username or password</span>';

		header("Location: index.php?errorMessage=$errorMessage");

		exit;

	}

}



?>

<?php

$msg=$_GET[msg];



if($msg){

	if($msg=="noverify"){

		$msg="You have not verified your e-mail ID. Please <a href=javascript:TINY.box.show('resend_verification.php',1,0,0,4)>click here</a> to resend verification e-mail.";

	}

	?>

	<style type="text/css">

    .corner-box {	width: 400px;

        margin-left: 15px;

    }

    .portal-box-contents{

        background1: url(portal-box-bottom.png) no-repeat bottom left;

        border:1px solid #666;

		padding:10px;

    }

    </style>

	<div class="<?=($msg_cls==""?"msg_green":"$msg_cls")?>"><?=$msg?></div>

	<?

}

?>

<div style="float:right;position:absolute; top:-24px; right:-30px;"><a href="javascript:TINY.box.hide()"><img src="images/close_tiny.png" alt="Close" /></a></div> 





<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;

}



.s_btn {

	-moz-box-shadow:inset 0px 1px 0px 0px #dcecfb;

	-webkit-box-shadow:inset 0px 1px 0px 0px #dcecfb;

	box-shadow:inset 0px 1px 0px 0px #dcecfb;

	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #bddbfa), color-stop(1, #80b5ea) );

	background:-moz-linear-gradient( center top, #bddbfa 5%, #80b5ea 100% );

	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#bddbfa', endColorstr='#80b5ea');

	background-color:#bddbfa;

	-webkit-border-top-left-radius:0px;

	-moz-border-radius-topleft:0px;

	border-top-left-radius:0px;

	-webkit-border-top-right-radius:0px;

	-moz-border-radius-topright:0px;

	border-top-right-radius:0px;

	-webkit-border-bottom-right-radius:0px;

	-moz-border-radius-bottomright:0px;

	border-bottom-right-radius:0px;

	-webkit-border-bottom-left-radius:0px;

	-moz-border-radius-bottomleft:0px;

	border-bottom-left-radius:0px;

	text-indent:0;

	border:1px solid #84bbf3;

	display:inline-block;

	color:#ffffff;

	font-family:Arial;

	font-size:15px;

	font-weight:bold;

	font-style:normal;

	height:33px;

	line-height:33px;

	width:85px;

	text-decoration:none;

	text-align:center;

	text-shadow:1px 1px 0px #528ecc;

}

.s_btn:hover {

	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #80b5ea), color-stop(1, #bddbfa) );

	background:-moz-linear-gradient( center top, #80b5ea 5%, #bddbfa 100% );

	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80b5ea', endColorstr='#bddbfa');

	background-color:#80b5ea;

}.s_btn:active {

	position:relative;

	top:1px;

}





/* 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 

{

	background1: url(portal-box-bottom.png) no-repeat bottom left;

	border:1px solid #CCC; margin:10px auto;

	padding: 10px; width:450px; height:240px; 

	

	box-shadow: 1px 1px 4px rgba(0, 0, 0, .4);

    -moz-box-shadow: 1px 1px 4px rgba(0, 0, 0, .4);

    -webkit-box-shadow: 1px 1px 4px rgba(0, 0, 0, .4);

    -ms-box-shadow: 1px 1px 4px rgba(0, 0, 0, .4);

}



.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>	

	

<div style="width:600px">

	<div class="portal-box-contents">



	<h2 style="padding:10px 0px; margin-bottom:25px; color: red">Members Login...Year: BKP 2020-21</h2>



      <form action="login2.php" method="post">

        <?php echo $_GET[errorMessage]; ?>

        <div class="corner-box-"> <strong>Username&nbsp;&nbsp;&nbsp;&nbsp;</strong>

          <input type="text" name="username" id="username" style="width: 175px;" maxlength="30">

          <br>

          <br>

          <strong>Password &nbsp;&nbsp;&nbsp;&nbsp;</strong>

          <input type="password" name="password" id="password" style="width: 175px;" maxlength="30">

          <br>

          <br>

          <strong>Branch &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong>

          <select  name="city" style="width: 175px;">

            <!--option value="amritser">Amritsar</option-->

            <option value="ludhiana">Ludhiana</option>

          </select>

           

          <br/>

          <br/>

        </div>

        <center>

          <span class="portal-button">

            <input type="submit" class="s_btn"  id='submit' onClick="return validate();" value=" Login &gt;&gt;">

          </span>

        </center>

      </form>

</div>

</div>


PK 99