Location: PHPKode > projects > php Blogger > signin.php
<?php session_start();
/* * ********************************************************************
*  Copyright notice PHP Blogger 1.1.
*
*  (c) 2011 Predrag Rukavina - admin[at]phpblogger[dot]org
*  All rights reserved
*
*  This script is part of the PHP Blogger project. 
*  The PHP Blogger project is free software; you can redistribute it and/or
*  modify it under the terms of the GNU General Public License
*  as published by the Free Software Foundation; either version 2
*  of the License, or (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
*  MA  02110-1301, USA.
*
*  This copyright notice MUST appear in all copies of the script!
* ********************************************************************** */
##############################
# signin.php     version 1.1.#
##############################
include ('settings.php');
include ('languages/lang_'.$language.'.php');
require_once ('classes/securesession.class.php');
unset($_SESSION['cusid']);
unset($_SESSION['INC_USER_ID']);
unset($_SESSION['INC_USER_NAME']);
unset($_SESSION['INC_USER_THUMB']);
unset($_SESSION['INC_USER_PRIV']);
unset($_SESSION['HTTP_USER_AGENT']);
unset($_SESSION['logged_in']);
unset($_SESSION['ss_fprint']);
if(($_POST['check']) <> $_SESSION['check']) {
	echo "$lang[WRONGCAP] <a href='userpanel.php'>$lang[GOBACK]</a>";
	die();
}
$ccuser = $_POST['username'];
$ccpass = $_POST['password'];
$name = array($ccuser,$ccpass);
foreach($name as $name) {
	if(preg_match('#[^A-Za-z0-9-]#',$name)) {
		echo "Illegal Characters";
		exit();
	}
	if(strlen($name) < 4) {
		echo "<center><div id=\"toprow\">The field must be at least 4 characters long.";
		exit();
	}
}
$ccpass = md5($_POST['password']);
$arecordSet = &$conn->Execute("SELECT * FROM users WHERE username = '".mysql_real_escape_string($ccuser)."' and password = '".mysql_real_escape_string($ccpass)."'");
if($arecordSet) {
	if($arecordSet->fields == 0) {
		echo "<div style=\"overflow:visible;background: lightyellow;border: 1px solid #555;color: #333;\">".
			$lang['SIGFAL']."</div>";
		include ('form.php');
		$recordSet->Close();
		$arecordSet->Close();
		$conn->Close();
		die();
	}
}
if(!$arecordSet)
	print $conn->ErrorMsg();
else
	while(!$arecordSet->EOF) {
		$active = $arecordSet->fields['active'];
		$kid = $arecordSet->fields['usid'];
		$incusername = $arecordSet->fields['username'];
		$incthumb = $arecordSet->fields['thumbs'];
		$incpriv = $arecordSet->fields['privilege'];
		$arecordSet->MoveNext();
	}
if($active == 0) {
	echo "<center><div style=\"margin-top:12px;background:#F8FAFC;text-align:left;border-top:1px solid #B5D4FE;border-bottom:1px solid #B5D4FE;width:444px;color:#444;font-family:'Lucida Grande',Verdana,Arial,Sans-Serif;font-size:10px;padding:5px 20px 5px 45px;\">$lang[SIGNOT]</div><br />";
	exit();
}
if($active == 3) {
	echo "<center><div style=\"margin-top:12px;background:#F8FAFC;text-align:left;border-top:1px solid #B5D4FE;border-bottom:1px solid #B5D4FE;width:444px;color:#444;font-family:'Lucida Grande',Verdana,Arial,Sans-Serif;font-size:10px;padding:5px 20px 5px 45px;\">$lang[SIGAPR]</div>";
	exit();
}
$ss = new SecSession();
$ss->check_browser = true;
$ss->check_ip_blocks = 2;
$ss->secure_word = 'ESALT_';
$ss->regenerate_id = true;
$ss->Open();
$_SESSION['INC_USER_ID'] = $kid;
$_SESSION['INC_USER_NAME'] = $incusername;
$_SESSION['INC_USER_THUMB'] = $incthumb;
$_SESSION['INC_USER_PRIV'] = $incpriv;
$_SESSION['logged_in'] = true;
$brecordSet = &$conn->Execute("UPDATE users SET  lastime = NOW() WHERE `usid` = '".mysql_real_escape_string($kid)."'"); ?>
<head>
<script type="text/javascript">
function delayer(){
window.location = "<?php echo $sitepath; ?>"
}
</script>
</head>
<body onLoad="setTimeout('delayer()', 1800)">
<center><img style="margin-top:120px;" src="<?php echo $sitepath; ?>/themes/<?php echo $themes; ?>/styles/images/36-0.gif" border="0">
<center><b><font style="font-family:verdana;font-size:13px;color:#555;"><?php ?></b></font></center>
<?php $recordSet->Close();
$arecordSet->Close();
$brecordSet->Close();
$conn->Close();
exit();
?>
Return current item: php Blogger