PK

ADDRLIN : /home/anibklip/pcfcindia.com/19-20/superadmin/
FLL :
Current File : /home/anibklip/pcfcindia.com/19-20/superadmin/login.php

<?php
$_SESSION["user"]="$username";
session_start();
$errorMessage = '';
if (isset($_POST['username']) && isset($_POST['password'])) {
    
include("../connexion.php");
   $tname = $_POST['username'];
   $Password1 =md5($_POST['password']);

   // check if the user id and password combination exist in database
   $sql = "SELECT user
           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
      $_SESSION['super'] = true;
	  //Lets update last login time
$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: admin.php');
      exit;
   } else {
      $errorMessage = 'Sorry, wrong user id / password';
   }
}
?>


<?php
include "head.php";
?><br>
<br>


<div id="main">



<div id="middle_column">

<div id="mainContent">
<div class="section"> 
    <h2 id="icon_pick">Welcome Superadmin, login below to continue into Management area.</h2> 
<br>
<br>
<?php

if ($errorMessage != '')
 {
echo "<p align=center><strong><font color=#990000> $errorMessage</font></strong></p>";
}?>
<table width="760" align="center">
<tr>
<td width="100%" align="center" valign="top">
<table>
<form  method="post" name="clntLogin" id="clntLogin">
<tr>
	<td>Superadmin User Name:</td>
	<td><input type="text" name="username"></td>
</tr>

<tr>
	<td>Superadmin User Password:</td>
	<td><input type="password" name="password"></td>
</tr>

<tr>
	<td align="center" colspan="2"><input type="submit" name="submit" value="login"></td>
</tr>

</form>


</table>
<br><br>
</td>
</table>
<br>

		</div>
</div>

</div><br>
<br>
<?php
include "foot.php";
?>


PK 99