<?php
require_once('../pr-config/config.php');
require_once('../pr-inside/database-connect.php');
if(isset($_POST['redir']))
$Redir = $_POST['redir'];
elseif(isset($_GET['redir']))
$Redir = $_GET['redir'];
else
$Redir = $_SERVER['HTTP_REFERER'];
?>
<?php
if(isset($_POST['validate']))
{
$ID = strtolower(trim($_POST['username']));
$Password = md5($_POST['password']);
$AdminID = $DC->Result("SELECT * FROM ".PR_DATABASE_PREFIX."config WHERE config_name = 'admin_id'");
$AdminPassword = $DC->Result("SELECT * FROM ".PR_DATABASE_PREFIX."config WHERE config_name = 'admin_password'");
$AdminID = $AdminID[0]['config_value'];
$AdminPassword = $AdminPassword[0]['config_value'];
if($AdminID !== $ID)
{
$ErrorType = 'Wrong ID';
}
elseif($AdminPassword !== $Password)
{
$ErrorType = 'Wrong Password';
}
else
{
session_start();
$_SESSION['admin'] = true;
header("Location: $Redir");
exit();
}
$Error = "<tr> <td align='center'> <font color='red' size='+2'> {$ErrorType} </font> </td> </tr>";
}
?>
<!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>Sign-in /Prsaar</title>
<style>
#show{
background:white;
border:1px solid #a2a2a2;
margin:5em auto;
padding:1.5em;
width:25em;
}
strong{
font-family:Georgia, "Times New Roman", Times, serif;
font-size:large;
font-weight:normal;
}
.input{
font-family:Arial, Helvetica, sans-serif;
color:#000000;
font-size:x-large;
font-weight:bold;
}
</style>
</head>
<body bgcolor="#EEEEEE">
<div id="show">
<a href="http://prsaar.com/"><span style="text-decoration:none; font-weight:normal; font-size:64px; color:#000000; letter-spacing:4px; font-family:Georgia, 'Times New Roman', Times, serif; padding:0;">Prsaar</span></a> <strong>Networking Platform</strong>
<table align="center"> <form action="signin.php" method="post">
<?php if(isset($Error)) echo $Error; ?>
<tr>
<td align="left"> <strong> Admin ID </strong> </td>
</tr>
<tr>
<td> <input type="text" name="username" size="16" class="input" <?php if(isset($ID)) print "value='{$ID}'"; ?> /> </td>
</tr>
<tr>
<td align="left"> <strong> Password </strong> </td>
</tr>
<tr>
<td> <input type="password" name="password" size="16" class="input" /> </td>
</tr>
<tr>
<td align="left"> <input type="hidden" name="validate" value="true" /> </td>
</tr>
<tr>
<td align="right"> <input type="hidden" name="redir" value="<?php _p($Redir); ?>" /> <input type="submit" value="Signin »" style="font-size:32px;" /> </td>
</tr>
</form> </table>
<a href="../index.php" style="color:blue">Back to profile</a>
</div>
</body>
</html>