Example #1
0
<?php

global $_zp_conf_vars;
require_once dirname(__FILE__) . '/zenphoto/zp-data/zenphoto.cfg.php';
require_once dirname(__FILE__) . '/definitions.php';
require LIB_DIR . '/krumo/class.krumo.php';
require LIB_DIR . '/db/common.php';
require LIB_DIR . '/utilities.php';
require LIB_DIR . '/string.php';
require LIB_DIR . '/numbers.php';
require LIB_DIR . '/arrays.php';
require LIB_DIR . '/forms.php';
require LIB_DIR . '/dahlen/dahlen_menu.php';
require LIB_DIR . '/dahlen/dahlen_image.php';
require LIB_DIR . '/dahlen/dahlen_slideshow.php';
require LIB_DIR . '/dahlen/dahlen_project.php';
require LIB_DIR . '/dahlen/dahlen_playlist.php';
require LIB_DIR . '/dahlen/dahlen_video.php';
require LIB_DIR . '/dahlen/dahlen_page.php';
$db_config = array('host' => $_zp_conf_vars['mysql_host'], 'username' => $_zp_conf_vars['mysql_user'], 'password' => $_zp_conf_vars['mysql_pass'], 'database' => $_zp_conf_vars['mysql_database']);
if (DB_EXTENSION_TO_USE === 'mysqli') {
    require_once LIB_DIR . '/db/mysqli.php';
    MySQLi_DB::init();
    $dbh = mysqli_connect($db_config['host'], $db_config['username'], $db_config['password'], $db_config['database']);
    if (!$dbh) {
        die('Database error: ' . mysqli_connect_errno() . ' - ' . mysqli_connect_error());
    }
}
Example #2
0
//***************************************//
//  Global variables for use throughout  //
//***************************************//
$login_error = '';
$session_db = null;
$logged_in_user = NULL;
$json = array();
//*********************************************//
// Main session handling workflow operations.	//
// Calling to any of several helper functions  //
// below.											//
//*********************************************//
try {
    // if you cannot get a connection to the database
    // you cannot do anything else... Start processing.
    $mySQLi = new MySQLi_DB($_sqli_conf);
    if ($mySQLi->is_valid()) {
        // you've connected
        // get a pointer to the database for use in all future operations
        $session_db = $mySQLi->getLink();
        // insert or update last accessed on each logged-in session refresh
        if (isset($_COOKIE['nvsa_session'])) {
            $kp_session = (array) json_decode(base64_decode($_COOKIE['nvsa_session']));
            if (!isset($logged_in_user)) {
                $logged_in_user = new NVSA_USER($session_db, $kp_session);
            }
            $qry = "INSERT INTO `wb-user-meta` (user_id,meta_key,meta_value) VALUES ('" . $logged_in_user->ID() . "','last_accessed', CURRENT_TIMESTAMP)" . "ON DUPLICATE KEY UPDATE meta_value=CURRENT_TIMESTAMP;";
            $session_db->query($qry);
        }
        // note: tuck all echo statments away so they cannot accidentally fire
        // 	when this file is included. Only available upon "Action" request