<?php
if(!empty($HTTP_GET_VARS)) {
foreach($HTTP_GET_VARS as $k => $value) {
${$k} = $value;
}
}
if(!empty($HTTP_POST_VARS)) {
foreach($HTTP_POST_VARS as $k => $value) {
${$k} = $value;
}
}
if(!empty($HTTP_SESSION_VARS)) {
foreach($HTTP_SESSION_VARS as $k => $value) {
${$k} = $value;
}
}
if(!empty($_GET)) {
foreach($_GET as $k => $value) {
${$k} = $value;
}
}
if(!empty($_POST)) {
foreach($_POST as $k => $value) {
${$k} = $value;
}
}
require("root.inc");
if (is_readable($cbDirInclude.'db.php')){
require($cbDirInclude."db.php");
}else{
header("Location: http://".$_SERVER["HTTP_HOST"].substr($PHP_SELF ,0,strrpos($PHP_SELF ,"/")+1).$cbSetupUrl);
}
if(empty($db)) {
header("Location: system/setup/index.php");
exit();
}
include($cbDirInclude."config.ini");
include($cbDirLib."smarty/Smarty.class.php" );
include_once($cbDirLib."CB_option.class.php" );
$cbOption = new CBOption();
$cbOption->setModule("system");
$cbOption->getOptionList();
/*
* Setzen eines Standard Skin Directory's falls die Option nicht
* gesetzt ist
*/
if(!$cbOption->getSingleOption("skinDir")) {
$templateDir = "templates/default/";
} else {
$templateDir = $cbOption->getSingleOption("skinDir");
}
$cbDirGfx = $templateDir."images/gfx/";
/* global gültige Konstante mit dem Pfad zum Skin anlegen */
define("CB_TEMPLATE_DIR", $templateDir);
/* patTemplate Objekt ableiten und Template Verzeichnis setzen */
$tpl = new Smarty;
$tpl->template_dir = CB_TEMPLATE_DIR;
$tpl->compile_dir = CB_TEMPLATE_DIR."compiled/";
$tpl->config_dir = CB_TEMPLATE_DIR."config/";
if(isset($set)) {
if(isset($_POST[chkpass]) or empty($pass) or empty($user)) {
$aktion = "e5";
$zeit = date("Y-m-d H:i:s");
$IP = $REMOTE_ADDR;
$hostaddress = $_SERVER['REMOTE_ADDR'];
if (!$hostaddress) {
$hostaddress = $_SERVER['REMOTE_HOST'];
}
$hostaddress = @GetHostByAddr($hostaddress);
mysql_query("INSERT INTO ".TABLE."_stats VALUES ('unknown','$aktion','$zeit','$IP $hostaddress')");
exit();
}
if(isset($login))
{
$chk = mysql_query("SELECT * FROM ".TABLE."_user WHERE name = '$user'");
if(empty($chk))
{
$notfound = true;
}
if($chk) {
$chk = mysql_fetch_array($chk);
$chkpass = $chk["passwort"];
$chkuser = $chk["name"];
$pass = md5($pass);
trim($pass);
trim($chkpass);
if($pass == $chkpass AND $chkuser == $user) {
@session_start();
mysql_query("UPDATE ".TABLE."_user SET last_intime = NOW()+0 WHERE userid = '".$chk[userid]."'");
$user = $chkuser;
session_register("user");
header("Location: main.php?cbMenuStage=hidden&".SID);
} else {
$chkpass = false;
}
}
}
}
$lang_pf = $cbOption->getSingleOption("lang");
if(file_exists($cbDirInclude."/lang_".$lang_pf.".ini")) {
include($cbDirInclude."/lang_".$lang_pf.".ini");
} else {
include($cbDirInclude."/lang_en.ini");
}
### Starting the template output ###
$t_basedir = CB_TEMPLATE_DIR;
$t_images = CB_TEMPLATE_DIR."images/";
$tpl->assign("GFX", $cbDirGfx);
$tpl->assign("IMAGEDIR", $t_images);
$tpl->assign("TEMPLATE_DIR", $t_basedir);
$tpl->assign("PHP_SELF", $PHP_SELF);
$tpl->assign("MENU_STAGE", $cbMenuNegativeStage);
$tpl->assign("URLIDENT", $load);
$tpl->assign("SID", $SID);
$tpl->assign("login_form_data",
array ( "VERSION" => $version,
"TXT_LOGIN" => $sys_msg["login"],
"TXT_USERNAME" => $sys_msg["username"],
"TXT_PASSWORD" => $sys_msg["password"]
)
);
if(isset($login)) {
if(isset($notfound)) {
$errorList[] = $sys_msg["user_not_found"];
}
if($chkpass == false) {
$errorList[] = $sys_msg["login_failed"];
}
if(!empty($errorList)) {
$tpl->assign("errorMessages", $errorList);
$tpl->assign("errorSet", "1");
}
}
$tpl->display("login.template");
?>