5) { $new_gc_probability = $gc_divisor * .2; ini_set('session.gc_probability',$new_gc_probability); } /* PHP5 Date problem solved.. ya'll GMT now! */ putenv("TZ=GMT"); /* Seed the random number */ srand((double) microtime() * 1000003); /**** END Set PHP Vars ****/ /* Check to see if they've tried to set no_session via get/post */ if (isset($_POST['no_session']) || isset($_GET['no_session'])) { /* just incase of register globals */ unset($no_session); debug_event('no_session','No Session passed as get/post','1'); } /* We have to check for HTTP Auth */ if (in_array("http",$results['auth_methods'])) { $username = scrub_in($_SERVER['PHP_AUTH_USER']); $results = vauth_http_auth($username); if ($results['success']) { vauth_session_cookie(); vauth_session_create($results); $session_name = vauth_conf('session_name'); $_SESSION['userdata'] = $results; $_COOKIE[$session_name] = session_id(); } } // end if http auth // If we don't want a session if (!isset($no_session) AND conf('use_auth')) { /* Verify Their session */ if (!vauth_check_session()) { logout(); exit; } /* Create the new user */ $user = new User($_SESSION['userdata']['username']); /* If they user ID doesn't exist deny them */ if (!$user->uid AND !conf('demo_mode')) { logout(); exit; } /* Load preferences and theme */ init_preferences(); set_theme(); $user->set_preferences(); $user->update_last_seen(); } elseif (!conf('use_auth')) { $auth['success'] = 1; $auth['username'] = '-1'; $auth['fullname'] = "Ampache User"; $auth['id'] = -1; $auth['access'] = "admin"; $auth['offset_limit'] = 50; if (!vauth_check_session()) { vauth_session_create($auth); } $user = new User(-1); $user->fullname = 'Ampache User'; $user->offset_limit = $auth['offset_limit']; $user->username = '-1'; $user->access = $auth['access']; $_SESSION['userdata']['username'] = $auth['username']; $user->set_preferences(); init_preferences(); set_theme(); } else { if (isset($_REQUEST['sessid'])) { $results = vauth_get_session($_REQUEST['sessid']); session_id(scrub_in($_REQUEST['sessid'])); session_start(); } $user = new user($results['username']); init_preferences(); } /* Add in some variables for ajax done here because we need the user */ $ajax_info['ajax_url'] = $results['web_path'] . '/server/ajax.server.php'; $ajax_info['ajax_info'] = '&user_id=' . $user->id . '&sessid=' . session_id(); conf($ajax_info); unset($ajax_info); // Load gettext mojo load_gettext(); /* Set CHARSET */ header ("Content-Type: text/html; charset=" . conf('site_charset')); /* Clean up a bit */ unset($array); unset($results); /* Setup the flip class */ flip_class(array('odd','even')); /* Setup the Error Class */ $error = new Error(); /* Set the Theme */ $theme = get_theme(conf('theme_name')); if (! preg_match('/update\.php/', $_SERVER['PHP_SELF'])) { $update = new Update(); if ($update->need_update()) { header("Location: " . conf('web_path') . "/update.php"); exit(); } } unset($update); ?>