<?
if (!(isset ($g['to_root'])))
{
$g['to_root'] = './';
}
$p = basename ($_SERVER['PHP_SELF']);
$g['path']['dir_main'] = str_replace ('_include/core', '', str_replace ('_include\\core', '', dirname (__FILE__))) . '/';
$g['path']['dir_files'] = $g['path']['dir_main'] . '_files/';
$g['path']['dir_tmpl'] = $g['path']['dir_main'] . '_themes/';
$g['path']['dir_lang'] = $g['path']['dir_main'] . '_lang/';
$g['path']['dir_include'] = $g['path']['dir_main'] . '_include/';
if (!(isset ($g['path']['url_main'])))
{
$g['path']['url_main'] = 'http://' . str_replace ('\\', '', str_replace ('//', '/', str_replace ('_server/', '', $_SERVER['HTTP_HOST'] . dirname ($_SERVER['PHP_SELF'])) . '/')) . ($g['to_root'] == './' ? '' : $g['to_root']);
}
$g['path']['url_tmpl'] = $g['path']['url_main'] . '_themes/';
$g['path']['url_files'] = $g['path']['url_main'] . '_files/';
$g['path']['url_gold_relative'] = '';
include dirname (__FILE__) . '/x.php';
$PHP = explode ('.', phpversion ());
$g['php'] = $PHP[0];
$g['php2'] = $PHP[1];
if ($g['php'] == 5)
{
if (function_exists ('date_default_timezone_set'))
{
@date_default_timezone_set (@date_default_timezone_get ());
}
}
set_magic_quotes_runtime (false);
include_once $g['to_root'] . '_include/lib/lib.php';
error_reporting (2047);
set_error_handler ('error_handler');
if (!(isset ($g['error_output'])))
{
$g['error_output'] = '';
}
if ((isset ($_COOKIE['PHPSESSID']) ? $_COOKIE['PHPSESSID'] : false))
{
session_id ((isset ($_COOKIE['PHPSESSID']) ? $_COOKIE['PHPSESSID'] : ''));
}
session_start ();
setcookie ('PHPSESSID', session_id (), time () + 31622400, '/', $domain);
$g['character_set'] = 'Y';
include_once $g['to_root'] . '_include/config/db.php';
if ($g['php'] == 4)
{
include_once $g['to_root'] . '_include/lib/db.php';
}
else
{
if ($g['php'] == 5)
{
include_once $g['to_root'] . '_include/lib/db5.php';
}
}
db::connect ();
if (!((isset ($g['no_image']) AND $g['no_image'])))
{
include_once $g['to_root'] . '_include/lib/image.php';
}
include_once $g['to_root'] . '_include/current/upload.php';
include_once $g['to_root'] . '_include/current/ajax.php';
include_once $g['to_root'] . '_include/config/main.php';
if (!((isset ($g['no_image']) AND $g['no_image'])))
{
include_once $g['to_root'] . '_include/config/image.php';
}
include_once $g['to_root'] . '_include/config/options.php';
include_once $g['to_root'] . '_include/config/filter.php';
include_once $g['to_root'] . '_include/config/user_const.php';
include_once $g['to_root'] . '_include/config/user_set.php';
include_once $g['to_root'] . '_include/config/pay.php';
include_once $g['to_root'] . '_pay/pay_start.php';
include_once $g['to_root'] . '_include/lib/html.php';
include_once $g['to_root'] . '_include/lib/block.php';
include_once $g['to_root'] . '_include/lib/list.php';
include_once $g['to_root'] . '_include/current/common.php';
include_once $g['to_root'] . '_include/current/users.php';
include_once $g['to_root'] . '_include/current/mail.php';
$p = basename ($_SERVER['PHP_SELF']);
$g_user = array ();
$g_info = array ();
if (isset ($area))
{
if ($area == 'test')
{
$access = 'Y';
}
}
if (get_session ('user_id') != get_session ('user_id_verify'))
{
set_session ('user_id', get_session ('user_id_verify'));
}
if (get_session ('user_id'))
{
if (db::query ('SELECT *, floor((TO_DAYS(now())-TO_DAYS(birth))/365) AS age FROM user WHERE user_id=' . get_session ('user_id') . ''))
{
$area = 'login';
$g_user = db::fetch_row ();
$free = db::result ('SELECT free FROM const_orientation WHERE id=' . $g_user['orientation'] . '');
if ($free == 'Y')
{
$g_user['gold_days'] = 100000;
}
db::execute ('UPDATE user SET last_visit=now(), last_ip=' . to_sql ($_SERVER['REMOTE_ADDR'], 'Text') . ' WHERE user_id=' . get_session ('user_id') . '');
$g_info['new_mails'] = db::result ('SELECT COUNT(id) FROM mail_msg WHERE user_to=' . get_session ('user_id') . ' AND new=\'Y\'');
$g_info['new_interest'] = db::result ('SELECT COUNT(user_from) FROM users_interest WHERE user_to=' . get_session ('user_id') . ' AND new=\'Y\'');
$g_info['users_view_new'] = db::result ('SELECT COUNT(user_from) FROM users_view WHERE user_to=' . get_session ('user_id') . ' AND new=\'Y\'');
$g_info['users_view_total'] = db::result ('SELECT COUNT(user_from) FROM users_view WHERE user_to=' . get_session ('user_id') . '');
$g_info['users_online'] = db::result ('SELECT COUNT(user_id) FROM user WHERE user_id!=' . $g_user['user_id'] . ' AND (orientation=' . $g_user['p_orientation'] . ') AND last_visit>\'' . date ('Y-m-d H:i:s', time () - $g['options']['online_time'] * 60) . '\'');
$g_info['users_total'] = db::result ('SELECT COUNT(user_id) FROM user WHERE orientation=' . $g_user['p_orientation'] . '');
}
}
else
{
$area = 'public';
$g_info['users_online'] = db::result ('SELECT COUNT(user_id) FROM user WHERE last_visit>\'' . date ('Y-m-d H:i:s', time () - $g['options']['online_time'] * 60) . '\'');
$g_info['users_total'] = db::result ('SELECT COUNT(user_id) FROM user WHERE 1');
$pages_area = array ('index.php', 'join.php', 'join2.php', 'join3.php', 'forget_password.php', 'contact.php', 'help.php', 'news.php', 'search_results.php', 'after.php');
if (!(isset ($access)))
{
$access = 'N';
}
foreach ($pages_area as $k => $v)
{
if ($p == $v)
{
$access = 'Y';
continue;
}
}
if ($access == 'N')
{
redirect ('index.php?cmd=please_register');
}
$g_user['user_id'] = 0;
$g_user['country_id'] = 0;
$g_user['state_id'] = 0;
$g_user['city_id'] = 0;
$g_user['set_im_popup'] = 'N';
$g_user['gold_days'] = 0;
}
include_once $g['to_root'] . '_include/config/lang.php';
if (get_param ('set_language', '') != '')
{
set_session ('set_language', get_param ('set_language', ''));
set_cookie ('set_language', get_param ('set_language', ''));
}
if (get_session ('set_language') != '')
{
if (file_exists ($g['path']['dir_lang'] . 'main/' . get_session ('set_language') . '/language.php'))
{
include_once $g['path']['dir_lang'] . 'main/' . get_session ('set_language') . '/language.php';
}
}
else
{
if (get_cookie ('set_language') != '')
{
if (file_exists ($g['path']['dir_lang'] . 'main/' . get_cookie ('set_language') . '/language.php'))
{
include_once $g['path']['dir_lang'] . 'main/' . get_cookie ('set_language') . '/language.php';
}
}
else
{
if (file_exists ($g['lang']['main'] . 'language.php'))
{
include_once $g['lang']['main'] . 'language.php';
}
else
{
include_once $g['path']['dir_lang'] . 'main/default/language.php';
}
}
}
if (!((isset ($g['no_headers']) AND $g['no_headers'])))
{
header ('Content-Type: text/html; charset=UTF-8');
}
include $g['to_root'] . '_include/config/tmpls.php';
if (get_param ('set_template', '') != '')
{
set_session ('set_template', get_param ('set_template', ''));
set_cookie ('set_template', get_param ('set_template', ''));
}
if (get_session ('set_template') != '')
{
if (is_dir ($g['path']['dir_tmpl'] . 'main/' . get_session ('set_template') . '/'))
{
$g['tmpl']['dir_tmpl_main'] = $g['path']['dir_tmpl'] . 'main/' . get_session ('set_template') . '/' . $area . '/';
$g['tmpl']['url_tmpl_main'] = $g['path']['url_tmpl'] . 'main/' . get_session ('set_template') . '/' . $area . '/';
}
}
else
{
if (get_cookie ('set_template') != '')
{
if (is_dir ($g['path']['dir_tmpl'] . 'main/' . get_cookie ('set_template') . '/'))
{
$g['tmpl']['dir_tmpl_main'] = $g['path']['dir_tmpl'] . 'main/' . get_cookie ('set_template') . '/' . $area . '/';
$g['tmpl']['url_tmpl_main'] = $g['path']['url_tmpl'] . 'main/' . get_cookie ('set_template') . '/' . $area . '/';
}
}
}
$g['sql']['photo_vis'] = '';
if ($g['options']['photo_approval'] == 'Y')
{
$g['sql']['photo_vis'] = ' AND visible=\'Y\' ';
}
$g['sql']['video_vis'] = '';
if ($g['options']['video_approval'] == 'Y')
{
$g['sql']['video_vis'] = ' AND visible=\'Y\' ';
}
$g['sql']['audio_vis'] = '';
if ($g['options']['audio_approval'] == 'Y')
{
$g['sql']['audio_vis'] = ' AND visible=\'Y\' ';
}
?>