<?php session_start();
###############################
#signin.php version 1.1.#
###############################
require_once 'securesession.class.php';
require_once 'salt.php';
include ('../classes/adodb/adodb.inc.php');
include ('config.php');
$dbdriver = "mysql";
$conn = &ADONewConnection($dbdriver);
$conn->Connect($server,$user,$password,$database);
$error = '';
if(isset($_POST['Submit'])) {
$ccuser = $_POST['username'];
$ccpass = $_POST['password'];
if(get_magic_quotes_gpc()) {
$ccuser = stripslashes($ccuser);
$ccpass = stripslashes($ccpass);
}
$name = array($ccuser,$ccpass);
foreach($name as $name) {
if(preg_match('#[^A-Za-z0-9-]#',$name)) {
echo "<center><span class=\"error\">Illegal Characters";
die();
}
if(strlen($name) < 4) {
echo "<center><span class=\"error\">The field must be at least 4 characters long.";
die();
}
}
$ccpass = md5($_POST['password']);
$brecordSet = &$conn->Execute("SELECT * FROM cpadmin WHERE ausername = '".
mysql_real_escape_string($ccuser)."' and apassword = '".
mysql_real_escape_string($ccpass)."'");
if($brecordSet) {
if($brecordSet->fields == 0) {
echo "Sorry, user you are looking for does not exist.";
$brecordSet->Close();
$conn->Close();
die();
}
}
if(!$brecordSet)
print $conn->ErrorMsg();
else
while(!$brecordSet->EOF) {
$bval[] = $brecordSet->fields;
$uname = $brecordSet->fields['ausername'];
$brecordSet->MoveNext();
$ss = new SecureSession();
$ss->check_browser = true;
$ss->check_ip_blocks = 2;
$ss->secure_word = $salt;
$ss->regenerate_id = true;
$ss->Open();
$_SESSION['CC_MODER'] = $uname;
$_SESSION['logged_in'] = true;
$conn->Close();
header('Location: index.php');
die();
}
} else {
?>
<html>
<head>
<meta charset="UTF-8" />
<link type="text/css" href="style.css" rel="stylesheet" />
<title></title>
</head>
<br />
<form action="signin.php" name="ccform" method="post">
<div style="margin:0px auto;width:296px;background-color:#E4EBF8;border:1px dotted #B1C7DE;padding:8px;">
<font style="font-size:18px;color:#555555">Login</font>
<br /><font style="font-size:12px;color:#555555">Username<br />
<input class="incc"maxlength="25" name="username" type="text" />
<br /><br />
<font style="font-size:12px;color:#555555">Password <br />
<input class="incc" maxlength="25" name="password" type="password" /><br /><br />
<input class="incc" type="submit" value="Sign In" name="Submit" type="button" /><br /><br />
</div>
</form>
<?php
$conn->Close();
}
?>