<?php
if(!isset($_SESSION)) 
session_start();
if(isset($_SESSION['admin_wsvc']))
{
header("location:settings.php");
}
else
{
include 'common/header.php';
?>
<title>Login: <?php echo(get_title()) ?></title>
</head>
<body class="metrouicss" onload="prettyPrint()">
<div class="container" style="width:940px;margin:auto;">
<div class="page">
<div class="nav-bar" style="background:<?php echo(retColor()); ?>">
    <div class="nav-bar-inner padding10">
        <span class="pull-menu"></span>

        <a href="<?php echo(rootpath()) ?>"><span class="element brand">
            <img class="place-left" src="images/logo32.png" style="height: 20px"/>
            <?php echo(get_title()) ?>
        </span></a>
    </div>
</div>
</div>
<?php 
if(isset($_POST['username']) && isset($_POST['password']))
{
$username = $_POST["username"];
$password = md5($_POST["password"]);
$match = "select title from settings where username = '".$username."' and password = '".$password."';"; 
$qry = mysql_query($match);
$num_rows = mysql_num_rows($qry); 
if ($num_rows <= 0) {
include 'inc/loginbox.php';
?>
							<div class="notices">
    <div class="bg-color-red">
	<a href="#" class="close"></a>
    <div class="notice-icon"> <img src="images/shield-user.png"></img> </div>
    <div class="notice-image"> <img src="images/armor.png"></img> </div>
    <div class="notice-header fg-color-yellow">Login Error !</div>
    <div class="notice-text">Username or Password Is Incorrect Please Retry !</div>
    </div>
    </div>
</div>
</div>
<?php
} 
else {
while($row = mysql_fetch_array($qry)) 
{
	$_SESSION['admin_wsvc']= 1;
} 
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=settings.php">';    
exit;    
}
}
else
{
include 'inc/loginbox.php';
echo '</div></div>';
}
?>
</div>
<?php include 'common/footer.php'; 
}
?>