mysql_connect($DB_ADDRESS, $DB_USER, $DB_PASS) or die(mysql_error()); mysql_select_db($DB_NAME) or die(mysql_error()); // To protect MySQL injection (more detail about MySQL injection) $username = mysql_real_escape_string(stripslashes(request_isset('myusername'))); $password = mysql_real_escape_string(stripslashes(request_isset('mypassword'))); $authManager = new AuthManager(); $checkLogin = $authManager->checkLogin($username, $password); // if a single record was found given the username and password if ($checkLogin['count'] == 1) { // store nessasary data to the session $_SESSION['USER_ID'] = $checkLogin['USER_ID']; $_SESSION['usertype'] = $checkLogin['user_type']; $_SESSION['username'] = $username; $sessionManager = new sessionManager($checkLogin['USER_ID'], $checkLogin['user_type'], $username); $_SESSION['sessionManager'] = serialize($sessionManager); } } // END ----------------------------------------------------------------------------------- if ($sessionManager->isAuthorized()) { $USER_ID = $_SESSION['USER_ID']; $page_action = request_isset('action'); $db_link = DB_Connect($DB_ADDRESS, $DB_USER, $DB_PASS, $DB_NAME); } else { if (isset($forceLogin)) { if ($forceLogin == true) { require_once $relative_base_path . 'auth/login.php'; } } else { require_once $relative_base_path . 'auth/login.php'; } }
function InitPhpLogCon() { // Needed to make global global $gl_root_path, $content, $CFG; // Abort if already defined if (defined('PHPLOGCON_INITIALIZED')) { return; } // Init Basics which do not need a database InitBasicPhpLogCon(); // Will init the config file! InitPhpLogConConfigFile(); // Init UserDB related stuff! InitUserSystemPhpLogCon(); // Establish DB Connection if (GetConfigSetting("UserDBEnabled", false)) { DB_Connect(); } // Now load the Page configuration values InitConfigurationValues(); // Moved here, because we do not need if GZIP needs to be enabled before the config is loaded! InitRuntimeInformations(); // Now Create Themes List because we haven't the config before! CreateThemesList(); // Create Language List CreateLanguageList(); // Init Predefined Searches List CreatePredefinedSearches(); // Init predefined paging sizes CreatePagesizesList(); // Init predefined reload times CreateReloadTimesList(); // Init predefined reload times CreateExportFormatList(); // --- Enable PHP Debug Mode InitPhpDebugMode(); // --- // --- Init Allowed directories for DiskSources InitDiskAllowedSources(); // --- // --- Check and Remove Magic Quotes! RemoveMagicQuotes(); // --- // Finally defined PHPLOGCON_INITIALIZED! define('PHPLOGCON_INITIALIZED', TRUE); }
} else { if ($_SESSION['UserDBAuthMode'] == USERDB_AUTH_LDAP) { $_SESSION['MAIN_Username'] = $_SESSION['LDAPDefaultAdminUser']; $_SESSION['MAIN_Password1'] = ""; $_SESSION['MAIN_Password2'] = ""; } } // --- Now execute all commands ini_set('error_reporting', E_WARNING); // Enable Warnings! InitUserDbSettings(); // We need some DB Settings InitUserSystemPhpLogCon(); // We need the user system now! // Establish DB Connection DB_Connect(); // Everything is fine, lets go create the User! CreateUserName($_SESSION['MAIN_Username'], $_SESSION['MAIN_Password1'], 1); // Show User success! $content['MAIN_Username'] = $_SESSION['MAIN_Username']; $content['createduser'] = true; } // Init Source Options if (isset($_SESSION['SourceType'])) { $content['SourceType'] = $_SESSION['SourceType']; } else { $content['SourceType'] = SOURCE_DISK; } CreateSourceTypesList($content['SourceType']); if (isset($_SESSION['SourceName'])) { $content['SourceName'] = $_SESSION['SourceName'];
function DB_GetList($query, $parameters = null, $opt = array()) { DB_Connect(); $result = array(); $error = ''; $query = DB_ParseQueryParams($query, $parameters); $lines = mysql_query($query, $GLOBALS['db_link']) or $error = mysql_error($GLOBALS['db_link']) . '{ ' . $query . ' }'; if (trim($error) != '') { $DBERR = $error; logError('error_sql', $DBERR); } else { while ($line = mysql_fetch_array($lines, MYSQL_ASSOC)) { if (isset($keyByField)) { $result[$line[$keyByField]] = $line; } else { $result[] = $line; } } mysql_free_result($lines); } profile_point('DB_GetList(' . substr($query, 0, 40) . '...)'); return $result; }