<?php
require_once('config.php');
require_once('functions.php');
session_start();
if (isset($_SESSION["logged"]))
{
if ($_SESSION["logged"] == 'true')
{
header('location: index.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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=Windows-1255" />
<title>Panel - CssLearn</title>
<meta http-equiv="Content-Language" content="he" />
<meta name="description" content="Description" />
<meta name="keywords" content="Keywords" />
<meta name="author" content="Noy Rismani" />
<link rel="stylesheet" type="text/css" href="csslogin.css" />
</head>
<body>
<?php
if (!isset($_SESSION["logged"]))
{
echo <<<EOF
<div id="back">
<img src="images/logonoslogan2.jpg" />
<div id="box3">
<form method="post" action="login.php">
<br />
<table border="0" width="250">
<tr>
<td> Username </td> <td> <input type="input" name="name" MAXLENGTH=16 /></td>
</tr>
<tr>
<td>Password</td> <td><input type="password" name="password" MAXLENGTH=16 /></td>
</tr>
</table>
<div id="logini"><input type="submit" name="login" value="Login"/ ></div>
</form>
<div id="msg">
EOF;
if(isset($_POST['login']))
{
global $sql;
$username = htmlentities($_POST['name']);
dbConnect();
$query = dbQuery("SELECT * FROM uadmin WHERE username = '$username'");
$row = dbFetchAssoc($query);
if (mysql_num_rows($query) == 0)
{
echo "<font color='red'>Wrong Deatils</font>";
echo '<meta http-equiv="refresh" content="1" />';
}
else
{
$password = htmlentities($_POST['password']);
$md5 = md5($password);
$mek = 875;
$pass = "{$md5}{$mek}";
if($pass == $row['password'])
{
$_SESSION["logged"] = 'true';
global $tiz;
putenv($tiz);
$today = date("F j, Y, g:i a");
$query = dbQuery("UPDATE uadmin SET lastlogin = '$today' WHERE username = '$username'");
echo '<meta http-equiv="refresh" content="0" />';
}
else {
echo "<font color='red'>Wrong Deatils</font>";
echo '<meta http-equiv="refresh" content="1" />';
}
}
mysql_close();
}
echo <<<EOF
</div>
<div id="for"><a href="#">Forgot Password?</a></div>
</div>
</div>
<div id='copy2'> © SBNwp </div>
EOF;
}
?>
</body>
</html>