public function welcome() { /* 系统信息 */ $conn = mysql_connect(C('DB_HOST'), C('DB_USER'), C('DB_PWD')); $gd = gd_version(); $sys_info['os'] = PHP_OS; $sys_info['ip'] = $_SERVER['SERVER_ADDR']; $sys_info['web_server'] = $_SERVER['SERVER_SOFTWARE']; $sys_info['php_ver'] = PHP_VERSION; $sys_info['mysql_ver'] = mysql_get_server_info($conn); $sys_info['zlib'] = function_exists('gzclose') ? L('yes') : L('no'); $sys_info['safe_mode'] = (boolean) ini_get('safe_mode') ? L('yes') : L('no'); $sys_info['safe_mode_gid'] = (boolean) ini_get('safe_mode_gid') ? L('yes') : L('no'); $sys_info['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : L('no_timezone'); $sys_info['socket'] = function_exists('fsockopen') ? L('yes') : L('no'); if ($gd == 0) { $sys_info['gd'] = 'N/A'; } else { if ($gd == 1) { $sys_info['gd'] = 'GD1'; } else { $sys_info['gd'] = 'GD2'; } $sys_info['gd'] .= ' ('; /* 检查系统支持的图片类型 */ if ($gd && (imagetypes() & IMG_JPG) > 0) { $sys_info['gd'] .= ' JPEG'; } if ($gd && (imagetypes() & IMG_GIF) > 0) { $sys_info['gd'] .= ' GIF'; } if ($gd && (imagetypes() & IMG_PNG) > 0) { $sys_info['gd'] .= ' PNG'; } $sys_info['gd'] .= ')'; } /* IP库版本 */ $sys_info['ip_version'] = ecs_geoip('255.255.255.0'); /* 允许上传的最大文件大小 */ $sys_info['max_filesize'] = ini_get('upload_max_filesize'); $this->assign('sys_info', $sys_info); $this->assign('ecs_version', VERSION); $this->assign('ecs_release', RELEASE); $this->assign('ecs_charset', strtoupper(EC_CHARSET)); $this->assign('install_date', local_date(C('date_format'), C('install_date'))); // 检测是否授权 $data = array('appid' => ECTOUCH_AUTH_KEY); $empower = $this->cloud->data($data)->act('get.license'); $this->assign('empower', $empower); $this->display('welcome'); }
/** * 统计访问信息 * * @access public * @return void */ function visit_stats() { if (C('visit_stats') == 'off') { return; } $time = gmtime(); /* 检查客户端是否存在访问统计的cookie */ $visit_times = !empty($_COOKIE['ECS']['visit_times']) ? intval($_COOKIE['ECS']['visit_times']) + 1 : 1; setcookie('ECS[visit_times]', $visit_times, $time + 86400 * 365, '/'); $browser = get_user_browser(); $os = get_os(); $ip = real_ip(); $area = ecs_geoip($ip); /* 语言 */ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $pos = strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'], ';'); $lang = addslashes($pos !== false ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, $pos) : $_SERVER['HTTP_ACCEPT_LANGUAGE']); } else { $lang = ''; } /* 来源 */ if (!empty($_SERVER['HTTP_REFERER']) && strlen($_SERVER['HTTP_REFERER']) > 9) { $pos = strpos($_SERVER['HTTP_REFERER'], '/', 9); if ($pos !== false) { $domain = substr($_SERVER['HTTP_REFERER'], 0, $pos); $path = substr($_SERVER['HTTP_REFERER'], $pos); /* 来源关键字 */ if (!empty($domain) && !empty($path)) { save_searchengine_keyword($domain, $path); } } else { $domain = $path = ''; } } else { $domain = $path = ''; } $sql = 'INSERT INTO ' . $this->pre . 'stats ( ' . 'ip_address, visit_times, browser, system, language, area, ' . 'referer_domain, referer_path, access_url, access_time' . ') VALUES (' . "'{$ip}', '{$visit_times}', '{$browser}', '{$os}', '{$lang}', '{$area}', " . "'" . addslashes($domain) . "', '" . addslashes($path) . "', '" . addslashes(PHP_SELF) . "', '" . $time . "')"; $this->query($sql); }
} $sys_info['gd'] .= ' ('; /* 检查系统支持的图片类型 */ if ($gd && (imagetypes() & IMG_JPG) > 0) { $sys_info['gd'] .= ' JPEG'; } if ($gd && (imagetypes() & IMG_GIF) > 0) { $sys_info['gd'] .= ' GIF'; } if ($gd && (imagetypes() & IMG_PNG) > 0) { $sys_info['gd'] .= ' PNG'; } $sys_info['gd'] .= ')'; } /* IP库版本 */ $sys_info['ip_version'] = ecs_geoip('255.255.255.0'); /* 允许上传的最大文件大小 */ $sys_info['max_filesize'] = ini_get('upload_max_filesize'); $smarty->assign('sys_info', $sys_info); /* 缺货登记 */ $smarty->assign('booking_goods', $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('booking_goods') . ' WHERE is_dispose = 0')); /* 退款申请 */ $smarty->assign('new_repay', $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('user_account') . ' WHERE process_type = ' . SURPLUS_RETURN . ' AND is_paid = 0 ')); /* 如果管理员的最后登陆时间大于24小时则检查最新版本 */ if (gmtime() - $_SESSION['last_check'] > 3600 * 12) { $smarty->assign('need_check_version', 1); } assign_query_info(); $smarty->assign('ecs_version', VERSION); $smarty->assign('ecs_release', RELEASE); $smarty->assign('ecs_lang', $_CFG['lang']);
function Recordkeyword($word_www_68ecshop_com, $items = 0, $searchengine = 'ecshop') { if (strlen($word_www_68ecshop_com) < 3 || strlen($word_www_68ecshop_com) > 30 || strpos($word_www_68ecshop_com, ' ') !== false) { return; } $sql_www_68ecshop_com = "SELECT * FROM " . $GLOBALS['ecs']->table('keyword') . " WHERE searchengine='ecshop' AND word='{$word_www_68ecshop_com}'"; $r = $GLOBALS['db']->getRow($sql_www_68ecshop_com); if ($r) { $items = intval($items); $month_search = date('Y-m', $r['updatetime']) == date('Y-m', gmtime()) ? 'month_search+1' : '1'; $week_search = date('W', $r['updatetime']) == date('W', gmtime()) ? 'week_search+1' : '1'; $today_search = date('Y-m-d', $r['updatetime']) == date('Y-m-d', gmtime()) ? 'today_search+1' : '1'; $sql_www_68ecshop_com = "UPDATE " . $GLOBALS['ecs']->table('keyword') . " SET " . "items = '{$items}', " . "updatetime = '" . gmtime() . "', " . "total_search = total_search+1, " . "month_search = {$month_search}, " . "week_search = {$week_search}, " . "today_search = {$today_search} " . "WHERE w_id = '" . $r['w_id'] . "'"; $GLOBALS['db']->query($sql_www_68ecshop_com); $w_id = $r['w_id']; } else { $letter_www_68ecshop_com = gb2py($word_www_68ecshop_com); $sql_www_68ecshop_com = "INSERT INTO " . $GLOBALS['ecs']->table('keyword') . " (searchengine, word, keyword, letter, items, updatetime, total_search, " . "month_search, week_search, today_search, status) " . " VALUES ('{$searchengine}', '{$word_www_68ecshop_com}', '{$word_www_68ecshop_com}', '{$letter_www_68ecshop_com}', '{$items}', '" . gmtime() . "', '1', '1', '1', '1', '1')"; $GLOBALS['db']->query($sql_www_68ecshop_com); $w_id = $GLOBALS['db']->insert_id(); } if (!empty($w_id)) { $ip_www_68ecshop_com = real_ip(); $area_www_68ecshop_com = ecs_geoip($ip); $sql_www_68ecshop_com = 'INSERT INTO ' . $GLOBALS['ecs']->table('keyword_area') . ' ( ' . 'w_id, access_time, ip_address, area) VALUES (' . "'{$w_id}', '" . gmtime() . "', '{$ip_www_68ecshop_com}', '{$area_www_68ecshop_com}')"; $GLOBALS['db']->query($sql_www_68ecshop_com); } }
/** * 统计访问信息 * * @access public * @return void */ function visit_stats() { if (isset($GLOBALS['_CFG']['visit_stats']) && $GLOBALS['_CFG']['visit_stats'] == 'off') { return; } $time = gmtime(); /* 检查客户端是否存在访问统计的cookie */ $visit_times = (!empty($_COOKIE['ECS']['visit_times'])) ? intval($_COOKIE['ECS']['visit_times']) + 1 : 1; setcookie('ECS[visit_times]', $visit_times, $time + 86400 * 365, '/'); $browser = get_user_browser(); $os = get_os(); $ip = real_ip(); $area = ecs_geoip($ip); /* 语言 */ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $pos = strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'], ';'); $lang = addslashes(($pos !== false) ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, $pos) : $_SERVER['HTTP_ACCEPT_LANGUAGE']); } else { $lang = ''; } /* 来源 */ if (!empty($_SERVER['HTTP_REFERER']) && strlen($_SERVER['HTTP_REFERER']) > 9) { $pos = strpos($_SERVER['HTTP_REFERER'], '/', 9); if ($pos !== false) { $domain = substr($_SERVER['HTTP_REFERER'], 0, $pos); $path = substr($_SERVER['HTTP_REFERER'], $pos); /* 来源关键字 */ if (!empty($domain) && !empty($path)) { save_searchengine_keyword($domain, $path); } } else { $domain = $path = ''; } } else { $domain = $path = ''; } $sql = 'INSERT INTO ' . $GLOBALS['ecs']->table('stats') . ' ( ' . 'ip_address, visit_times, browser, system, language, area, ' . 'referer_domain, referer_path, access_url, access_time' . ') VALUES (' . "'$ip', '$visit_times', '$browser', '$os', '$lang', '$area', ". "'" . htmlspecialchars(addslashes($domain)) ."', '" . htmlspecialchars(addslashes($path)) ."', '" . htmlspecialchars(addslashes(PHP_SELF)) ."', '" . $time . "')"; $GLOBALS['db']->query($sql); }