<?php ob_start();
/**
*  Copyright 2008 Grestul Group 
*  Powered by Grestul
*  admin panel creator: Imad
**/
require "inc/config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <title><?php echo "$webad"; echo ' login'?></title>
      <link href="inc/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
session_start
();
if(isset(
$_COOKIE['grestul'])) {

include 
'inc/config.php';

$username $_COOKIE['grestul']['username'];
$passcode $_COOKIE['grestul']['passcode'];

$query "SELECT user, pass FROM index WHERE user = '$username' AND pass = '$passcode'";
$result mysql_query($query$db);
if(
mysql_num_rows($result)) {
    
$_SESSION['loggedin'] = 1;
    
header('Location: home.php');
$_SESSION['valid_user'] = $username;
      }
    exit();
}

?>
        <div class="login">
        <div class="header">
        <div class="headertxt">Please Login to Grestul</div>
<div class="wrap">

<form method="post" name="login" action="login.php">

<p><label for="username">Username:</label><br />

<input class="input" type="text" name="username" id="username" tabindex="1" /></p>

<p><label for="passcode">Password:</label><br />

<input class="input" type="password" name="passcode" id="passcode" tabindex="2" /></p>

<div class="submitpos">
<input class="submit" type="submit" name="submit" value="Login" tabindex="3" /> 
</div>

</form>
</div>

<?php
if (isset($_GET['error'])) 
 {
    echo 
'<div class="error">';
    echo 
'No Valid session found!';
    echo 
'</div>';
 }

if (!empty(
$_GET['inv'])) {
    echo 
'<div class="error">';
    echo 
'Wrong Username or Password!';
    echo 
'</div>';
 }

?>
        </div>

</body>
</html>