session_start(); $document_root = $_SERVER['DOCUMENT_ROOT']; date_default_timezone_set("Asia/Taipei"); ini_set('error_reporting','E_ALL'); ini_set('display_errors','0'); ini_set('log_errors','1'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', FALSE); header('Pragma: no-cache'); $http_host_ary= explode('.',$_SERVER['HTTP_HOST']); $sub_domain = $http_host_ary[0]; if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { $pre_url = 'https://'; } else { $pre_url = 'http://'; } $city = ''; $cpg = 1000; $twcu_list = array('zscc','kcu','ph','ckcc','hf','encounter'); if(in_array($sub_domain,$twcu_list)){ $host = $sub_domain . '.twcu.org.tw'; } $encrypt_key = $sub_domain . '.twcc.org.tw'; if($sub_domain == 'zscc'){ $DISTRICT = "中山"; $CC_NAME = '台北市中山社區大學'; $dbase = "twcuorgt_weychico_tpzscc"; $admin_mail = 'zscc@zscc.tp.edu.tw'; $city = 'tp'; } else if($sub_domain == 'encounter'){ $DISTRICT = "新莊"; $CC_NAME = '新北市新莊社區大學'; $dbase = "twcuorgt_encounter"; $admin_mail = 'webmail.hccu@encounter.org.tw'; $city = 'tp'; } else if($sub_domain == 'kcu'){ $DISTRICT = '基隆'; $CC_NAME = '基隆社區大學'; $dbase = "twcuorgt_kcu"; $admin_mail = 'cukeelung@gmail.com'; $city = 'kl'; }else if($sub_domain == 'ph'){ $DISTRICT = "澎湖縣"; $CC_NAME = '澎湖縣社區大學'; $dbase = "twcuorgt_ph"; $admin_mail = 'community.college1@gmail.com'; $city = 'tp'; }else if($sub_domain == 'ckcc'){ $DISTRICT = "崇光"; $CC_NAME = '新北市新店崇光社區大學'; $dbase = "twcuorgt_ckcc"; $admin_mail = 'ckcc.ckgsh@gmail.com'; $city = 'tp'; }else if($sub_domain == 'hf'){ $city = 'tc'; $DISTRICT = "后豐"; $CC_NAME = '臺中市后豐社區大學'; $dbase = "twcuorgt_tchf"; $admin_mail = 'weychi@ms12.url.com.tw'; } if($share_url == '') $share_url = 'http://' . $host . "/course"; $site_name = 'course'; ini_set('error_log',$document_root ."/" . $site_name . "/log/" . $sub_domain . "_" . date('Y-m-d') .".log"); $fullpath_app = $document_root . "/" . $site_name . "/"; $php_folder = "/" . $site_name . "/php/"; $admin_host = $host . "/admin"; $www_host = $host . "/" . $site_name; $front_url = $pre_url . $host . '/' . $site_name . '/'; $mobile_url = $pre_url . $host . '/' . $site_name . '/mobile/'; $admin_url = $pre_url . $host . '/admin/'; $_SESSION['front_url'] = $front_url; $admin_real_host = $host . "/admin"; $www_real_host = $host . "/" . $site_name . "/"; $base_folder = '/' . $site_name . '/'; $db_user = 'twcuorgt'; $db_pw = 'b74ec6150ec55ada8ba6b20c9acb3586';//'3uAtN55e9u'; $_SESSION['cpg'] = $cpg; $_SESSION['city'] = $city; $_SESSION['encrypt_key'] = $encrypt_key; $_SESSION['admin_mail'] = $admin_mail; $_SESSION['db'] = $dbase; $_SESSION['district'] = $DISTRICT;//"八德"; $_SESSION['db_user'] = $db_user;//"tybcuorg"; $_SESSION['db_pw'] = $db_pw;//"weychi3025"; $_SESSION['www_host'] = $www_host;//"localhost/tybcu"; $_SESSION['php_folder'] = $php_folder;//"php/"; $_SESSION['admin_host'] = $admin_host ;//"localhost/cc/course2_admin"; $_SESSION['admin_real_host'] = $admin_real_host ;//"localhost/cc/course2_admin"; $_SESSION['www_real_host'] = $www_real_host;//"localhost/tybcu"; $_SESSION['mailserver'] = "twcu.org.tw"; $_SESSION['ccname'] = $CC_NAME; if(!$dbc = mysql_connect('localhost', $db_user , $db_pw)){ // exit(); } mysql_query('SET NAMES utf8'); mysql_query('SET CHARACTER_SET_CLIENT=utf8'); mysql_query('SET CHARACTER_SET_RESULTS=utf8'); function w($str){ error_log($str); } ?>