<?php

/**
 *
 * INDEXU
 * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved.
 *
 * INDEXU(tm) is protected by Indonesia and International copyright laws.
 * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited,
 * violators will be prosecuted. To obtain a license for using INDEXU(tm),
 * please register at Nicecoder home page at http://www.nicecoder.com
 *
 * Author:
 *    Dody Rachmat Wicaksono (dody@nicecoder.com)
 *    M. Zuber (zubby@nicecoder.com)
 *
 */

function filter_start_session($type = "pre", $file = "") {
  if ($type == 'pre') {
    if (preg_match('/opera|msie|netscape|firefox|safari|konqueror|mozilla/msi', $_SERVER['HTTP_USER_AGENT'])) {
      if (!preg_match('/google|msn|yahoo|crawler|robot/msi', $_SERVER['HTTP_USER_AGENT'])) {
        session_cache_limiter('private, must-revalidate');
        session_start();
        $_SESSION['indexu_session_username'] = $_COOKIE['COOKIE_USERNAME'];
        if (strpos($_SERVER['REQUEST_URI'], '/admin/') !== FALSE) {
          $_SESSION['indexu_session_location'] = 'Administrator Area';
        }
        elseif (strpos($_SERVER['REQUEST_URI'], '/cp/') !== FALSE) {
          $_SESSION['indexu_session_location'] = 'User Control Panel';
        }
        else {
          $_SESSION['indexu_session_location'] = $_SERVER['REQUEST_URI'];
        }
        $_SESSION['indexu_session_ip'] = $_SERVER["REMOTE_ADDR"];
      }
    }
  }
}

?>