PK

ADDRLIN : /home/anibklip/pcfcindia.com/dump/
FLL :
Current File : /home/anibklip/pcfcindia.com/dump/login2.php

<?
session_start();
$errorMessage = '';
if (isset($_POST['username']) && isset($_POST['password'])) {
    
if($_POST['city']=="amritser")
{
mysql_connect("localhost","pcfcindi_webmast","9{H)UBy<Q-}j") or  die('Could not connect to Server');
mysql_select_db("pcfcindi_newamritsar") or die('database not found');
}
else if($_POST['city']=="ludhiana")
{
mysql_connect("localhost","pcfcindi_webmast","9{H)UBy<Q-}j") or  die('Could not connect to Server');
mysql_select_db("pcfcindi_newludhiana") 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
           FROM amembs
           WHERE user = '$tname'
                 AND pass  =('$Password1')";

   $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);
      $_SESSION['city'] = $_POST['city'];
	   $_SESSION['user_id'] = $idc['id'];
	  
	  $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
      header('Location: member.php');
     // exit;
   } else {
      $errorMessage = 'Sorry, wrong user id / password';
   }
}
?>

<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="template.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="template2.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="content.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="portal-page.css" media="screen" title="Dalvay"/>
<script language="JavaScript" type="text/javascript">
<!--
function checkform ( form )
{

  // ** START **
  if (form.user.value == "") {
    alert( "Please enter user name." );
    form.user.focus();
    return false ;
  }
  // ** END **

  // ** START **
  if (form.pass.value == "") {
    alert( "Please enter password:" );
    form.pass.focus();
    return false ;
  }
  // ** END **
 
  
  return true ;
}
//-->
</script>
</head>

<body id="central" class="portal-page">

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

<div class="portal-box-header">
	<h1>
		Members Login...
	</h1>
</div>

<img src="bulk_mid.jpg" align="right" height="190">

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


<div class="corner-box">
<form action="" method="post" onSubmit="return checkform(this);">
<strong>Username >> </strong></font>
<input type="text" name="username" size="25" maxlength="30">
<br><br>
<strong>Password >>  </strong></font>
<input type="password" name="password" size="25" maxlength="30">
<br><br>
<strong>Branch  >> </strong></font>
                <select  name="city">
                <option value="amritser">Amritsar</option>
                <option value="ludhiana">Ludhiana</option>
                </select>
<br><br>
</div>
<center> <span class="portal-button"><input type="submit" class="amo-submit" value=" Login into Members Area >>"></form></span> </center>

</div> <!-- end .portal-box-contents  -->
</div> <!-- end .portal-box-interior  -->
</div> <!-- end .portal-box  -->
        <hr />

    <!-- start #footer -->
    
<div id="footer"> 
  <p dir="ltr">copyrights &#169; 2009&#8211;2010 Anibs Management Solutions</p>

    </div>
    <!-- end #footer -->

</body>
</html>


PK 99