Location: PHPKode > scripts > Ja2BU > login.php
<?php session_start();
/**********************************************************************
*  Copyright notice Ja2BU 1.1.
*
*  (c) 2011 Predrag Rukavina - admin[at]phpform[dot]net
*  All rights reserved
*
*  This script is part of the Ja2BU project. 
*  The Ja2BU 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!
************************************************************************/
unset($_SESSION['cusid']);
unset($_SESSION['INC_USER_ID']);
unset($_SESSION['INC_USER_NAME']);
unset($_SESSION['CC_MODER']);
unset($_SESSION['INC_USER_THUMB']);
unset($_SESSION['INC_USER_PRIV']);
unset($_SESSION['HTTP_USER_AGENT']);
unset($_SESSION['logged_in']);
unset($_SESSION['loggedin']);
unset($_SESSION['ss_fprint']);
unset($_SESSION['incsess']);
unset($_SESSION['inecsess']);
include ('settings.php');
if(isset($_POST['Submit'])) {
	if(!isset($_SESSION["jumps"]))
		$_SESSION["jumps"] = 0;
	$_SESSION["jumps"] = $_SESSION["jumps"] + 1;
	if($_SESSION["jumps"] > 25) {
		//echo "<center><div style='width:468px;height:25px;margin:0px auto;background: #F8F8F8;font-size:12px;color:#404040;font-family:tahoma;helvetica,arial;border-top: 1px dashed #EEE;margin-top:32px;padding-top:8px;'>Error</div></center>";
		//die();
	}
	if(get_magic_quotes_gpc()) {
		$ccuser = stripslashes($_POST['username']);
		$ccpass = stripslashes($_POST['password']);
	} else {
		$ccuser = $_POST['username'];
		$ccpass = $_POST['password'];
	}
	$name = array($ccuser,$ccpass);
	if($stopspam == 2) {
		if((@$_POST['check']) <> @$_SESSION['check']) {
			if(strlen($_POST['check']) < 4) {
				echo "<center><div style='width:468px;height:25px;margin:0px auto;background: #F8F8F8;font-size:12px;color:#404040;font-family:tahoma;helvetica,arial;border-top: 1px dashed #EEE;margin-top:32px;padding-top:8px;'>$lang[SEAERR5]</div></center>";
				die();
			}
			echo "<center><div style='width:468px;height:25px;margin:0px auto;background: #F8F8F8;font-size:12px;color:#404040;font-family:tahoma;helvetica,arial;border-top: 1px dashed #EEE;margin-top:32px;padding-top:8px;'>$lang[WRONGCAP] <a href='link.php'><font color='green'>$lang[GOBACK]</font></a></div></center>";
			unset($_SESSION['check']);
			session_destroy();
			die();
		}
	}
	foreach($name as $name) {
		if(preg_match('#[^A-Za-z0-9-]#',$name)) {
			echo "Illegal Characters";
			die();
		}
		if(strlen($name) < 4) {
			echo "<center><div id='error'>$lang[SEAERR5]";
			die();
		}
	}
	$ccpass = md5($_POST['password']);
	$brecordSet = $conn->Execute('SELECT * FROM users WHERE username = ? and password = ? LIMIT 1',array($ccuser,
		$ccpass));
	if($brecordSet) {
		if($brecordSet->fields == 0) {
			echo "<center><div style='width:468px;height:25px;margin:0px auto;background: #F8F8F8;font-size:12px;color:#404040;font-family:tahoma;helvetica,arial;border-top: 1px dashed #EEE;margin-top:32px;padding-top:8px;'>$lang[SIGFAL] <a href='link.php'><font color='green'>$lang[GOBACK]</font></a></div></center>";
			$conn->Close();
			die();
		} else {
			$sesrow = $brecordSet->fields['active'];
			if($sesrow == 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:Arial,Sans-Serif;font-size:14px;padding:5px 20px 5px 45px;'>$lang[SIGNOT]</div><br />";
				$conn->Close();
				exit();
			}
			if($sesrow == 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>";
				$conn->Close();
				exit();
			}
			require_once ('salt.php');
			require_once ('classes/securesession.class.php');
			$ss = new SecSession();
			$ss->check_browser = true;
			$ss->check_ip_blocks = 2;
			$ss->secure_word = $salt;
			$ss->regenerate_id = true;
			$ss->Open();
			$_SESSION['INC_USER_ID'] = $brecordSet->fields['usid'];
			$_SESSION['INC_USER_NAME'] = $brecordSet->fields['username'];
			$_SESSION['INC_USER_THUMB'] = $brecordSet->fields['thumbs'];
			$_SESSION['INC_USER_PRIV'] = $brecordSet->fields['privilege'];
			$_SESSION['loggedin'] = true;
			$incsess = md5(uniqid(rand(),TRUE));
			$_SESSION['inecsess'] = $incsess;
			session_write_close();
			$incuser = $brecordSet->fields['usid'];
			$brecordSet->MoveNext();
		}
		$conn->Close();
		@$return = $_POST['return'];
 ?>
<head>
<script type="text/javascript">
function delayer(){
window.location = "<?php echo $return; ?>"
}
</script>
</head>
<body onLoad="setTimeout('delayer()', 2000)">
<center><div style='text-align:center;width:468px;margin:0px auto;min-height:60px;max-height:80px;background: #F8F8F8;font-size:12px;color:#555;font-family:tahoma;helvetica,arial;border-top: 1px dashed #EEE;margin-top:32px;padding-top:8px;'>
<?php echo $lang['SIGFIR']; ?><br /><br /><img src="themes/<?php echo $themes; ?>/styles/images/ajax-loader.gif" border="0"><br /></div></center>
<?php
}
} else {
	@$ref = $_GET['ref'];
?>
<html>
<head>
<meta charset="UTF-8" />
</head>
<body>
<div>
<form class="message" action="login.php" name="ccform" method="post">
<?php
if(@$ref == true) {
echo "<input name='return' value='http://$ref' type='hidden'>";
	} else {
echo "<input name='return' value='$sitepath' type='hidden'>";
	}
?>
<h1><?php echo $lang['LOGLOGIN'] ?></h1>
<?php echo $lang['LOGENTER'] ?>
<br /><br />
<?php echo $lang['USER'] ?>:
<br />
<input name="username" type="text" />
<br /><br /><br />
<?php echo $lang['PASS'] ?>:
<br />
<input name="password" type="password" />
<br /><br />
<?php if($stopspam == 2) { ?>
<br />
<img src="captcha.php" id="img" width="75px" height="28px" border="0" title="<?php echo $lang['ENTERNUM'] ?>">
<br />
<?php echo $lang['ENTERNUM'] ?>
<br />
<input size="4" name="check">
<br /><br />
<?php } ?>
<br /><br />
<input type="submit" value="<?php echo $lang['LOGLOGIN'] ?>" name="Submit" type="button" />
<br /><br /><br />
    <?php echo $lang['LOGFORGO']; ?><br /><br />
    <?php echo $lang['LOGSIGNP']; ?><br />
</form>
</div>
<?php
}
######################################
##login.php                     1.1.##
######################################
?>
Return current item: Ja2BU