Bullet mold database main page
Welcome.
Please enjoy our bullet mold database. We'll be adding more functions and notes as we're able.
ini_set( 'session.save_path', '/tmp' );
if(!defined('INCLUDE_CHECK')) die('You are not allowed to execute this file directly');
session_start();
session_name('Login');
session_set_cookie_params(43200);
if($_SESSION['id'] && !isset($_COOKIE['Remember']) && !$_SESSION['rememberMe'])
{
// If you are logged in, but you don't have the Remember cookie (browser restart)
// and you have not checked the rememberMe checkbox:
$_SESSION = array();
session_destroy();
}
if(isset($_GET['logoff']))
{
$_SESSION = array();
session_destroy();
header("Location: index.php");
exit;
}
if($_POST['submit']=='Login')
{
// Checking whether the Login form has been submitted
$err = array();
// Will hold our errors
if(!$_POST['username'] || !$_POST['password'])
$err[] = 'All the fields must be filled in!';
if(!count($err))
{
$_POST['username'] = mysql_real_escape_string($_POST['username']);
$_POST['password'] = mysql_real_escape_string($_POST['password']);
$_POST['rememberMe'] = (int)$_POST['rememberMe'];
// Escaping all input data
$row = mysql_fetch_assoc(mysql_query("SELECT id,name, level FROM users WHERE name='{$_POST['username']}' AND pass='".md5($_POST['password'])."'"));
if($row['name'])
{
// If everything is OK login
$_SESSION['name']=$row['name'];
$_SESSION['id'] = $row['id'];
$_SESSION['level'] =$row['level'];
$_SESSION['rememberMe'] = $_POST['rememberMe'];
// Store some data in the session
setcookie('Remember',$_POST['rememberMe']);
}
else $err[]='Wrong username and/or password!';
}
if($err)
$_SESSION['msg']['login-err'] = implode('
',$err);
// Save the error messages in the session
header("Location: index.php");
exit;
}
//2 begin
if($_POST['submit']=='guest_auth')
{
$err = array();
if(!$_POST['guest_auth'])
$err[] = 'Auth Code required';
if(!count($err))
{
$_POST['guest_auth'] = mysql_real_escape_string($_POST['guest_auth']);
$row = mysql_fetch_assoc(mysql_query("SELECT auth_code FROM guest_id WHERE auth_code ='".$_POST['guest_auth']."' AND set='1'"));
if($row['auth_code'])
{
$_SESSION['auth_code']=$row['auth_code'];
setcookie('guest',$_POST['yes']);
$query = "SELECT guest_id WHERE auth_code ='".$_POST['guest_auth']."' UPDATE set = '1'";
mysql_query($query);
}
else $err[]='Bad Guest authentication';
}
if($err)
$_SESSION['msg']['auth-err'] = implode('
',$err);
header("Location: index.php");
exit;
}
//2 end
$script = '';
if($_SESSION['msg'])
{
// The script below shows the sliding panel on page load
$script = '
';
}
?>
Encrypted login required to continue
Please enjoy our bullet mold database. We'll be adding more functions and notes as we're able.