/** * 功能:与 ECShop 交换数据 * * @param array $certi 登录参数 * @param array $license 网店license信息 * @param bool $use_lib 使用哪一个json库,0为ec,1为shopex * @return array */ function exchange_shop_license($certi, $license, $use_lib = 0) { $touch =& get_instance(); if (!is_array($certi)) { return array(); } $touch->load->library('transport'); // include_once(ROOT_PATH . 'includes/cls_transport.php'); // include_once(ROOT_PATH . 'includes/cls_json.php'); $params = ''; foreach ($certi as $key => $value) { $params .= '&' . $key . '=' . $value; } $params = trim($params, '&'); $transport = new transport(); //$transport->connect_timeout = 1; $request = $transport->request($license['certi'], $params, 'POST'); $request_str = json_str_iconv($request['body']); // if (empty($use_lib)) // { //$json = new JSON(); $request_arr = json_decode($request_str, 1); // } // else // { // //include_once(ROOT_PATH . 'includes/shopex_json.php'); // $request_arr = json_decode($request_str, 1); // } return $request_arr; }
public function check_fee() { es_session::start(); $last_visit = intval(es_session::get("last_visit_smsbao")); if (get_gmtime() - $last_visit > 10) { $sms = new transport(); $params = array("u" => $this->sms['user_name'], "p" => md5($this->sms['password'])); $url = "http://www.smsbao.com/query"; $result = $sms->request($url, $params); $match = explode(',', $result['body']); if ($match[0] != '') { $remain = (int) $match[1]; $str = sprintf('短信宝增值平台 剩余:%d 条', $remain); } else { $str = "短信宝增值平台 (<a href='http://www.smsbao.com/reg?r=5001' target='_blank'><font color='red'>还没账号?点击这免费注册</font></a>)"; } es_session::set("smsbao_info", $str); es_session::set("last_visit_smsbao", get_gmtime()); return $str; } else { $qxt_info = es_session::get("smsbao_info"); if ($smsbao_info) { return $smsbao_info; } else { return "短信宝增值平台 (<a href='http://www.smsbao.com/reg?r=5001' target='_blank'><font color='red'>还没账号?点击这免费注册</font></a>)"; } } }
/** * 功能:与 ECShop 交换数据 * * @param array $certi 登录参数 * @param array $license 网店license信息 * @param bool $use_lib 使用哪一个json库,0为ec,1为shopex * @return array */ function exchange_shop_license($certi, $license, $use_lib = 0) { if (!is_array($certi)) { return array(); } include_once ROOT_PATH . 'includes/cls_transport.php'; include_once ROOT_PATH . 'includes/cls_json.php'; $params = ''; foreach ($certi as $key => $value) { $params .= '&' . $key . '=' . $value; } $params = trim($params, '&'); $transport = new transport(); //$transport->connect_timeout = 1; $request = $transport->request($license['certi'], $params, 'POST'); $request_str = json_str_iconv($request['body']); if (empty($use_lib)) { $json = new JSON(); $request_arr = $json->decode($request_str, 1); } else { include_once ROOT_PATH . 'includes/shopex_json.php'; $request_arr = json_decode($request_str, 1); } return $request_arr; }
public function check_fee() { $sms = new transport(); $url = $this->sms['server_url'] . "get"; $params = json_encode($this->sms); $result = $sms->request($url, $params); $result = json_decode($result['body'], 1); $str = $result['info']; return $str; }
public function check_fee() { $sms = new transport(); $params = array("OperID" => $this->sms['user_name'], "OperPass" => $this->sms['password']); $url = "http://221.179.180.158:9000/QxtSms/surplus"; $result = $sms->request($url, $params); $result = toArray($result['body'], "resRoot"); $str = "企信通短信平台,剩余:" . $result['rcode'][0] . "条"; return $str; }
public function call($operation, $params = '') { $this->log .= time() . ": call() called.\n"; if (!stristr($this->url, 'http://')) { throw new Exception("URL self::{$url} is not correct."); } if (!empty($params)) { $call['method'] = $operation; $call['params'] = $params; $postdata = $this->rc4(json_encode($call)); $postdata = 'call=' . str_replace('=', '', base64_encode($postdata)); $http = new transport(); $content = $http->request($this->url, $postdata); //$a = file_put_contents('debug.txt',base64_decode($content['body'])); $cbody = $this->rc4(base64_decode($content['body'])); return json_decode($cbody, true); } else { throw new Exception("params is empty."); } }
/** * 定位经续度 * @param unknown_type $x 经度 * @param unknown_type $y 纬度 */ public static function locate_geo($xpoint = 0, $ypoint = 0) { $xpoint = floatval($xpoint); $ypoint = floatval($ypoint); $current_geo = es_session::get("current_geo"); if ($xpoint != 0) { $current_geo['xpoint'] = $xpoint; $current_geo['address'] = ""; } elseif (empty($current_geo['xpoint'])) { $current_geo['xpoint'] = 0; } if ($ypoint != 0) { $current_geo['ypoint'] = $ypoint; $current_geo['address'] = ""; } elseif (empty($current_geo['ypoint'])) { $current_geo['ypoint'] = 0; } if ($current_geo['xpoint'] > 0 || $current_geo['ypoint'] > 0) { if ($current_geo['address'] == "") { $url = "http://api.map.baidu.com/geocoder/v2/?ak=FANWE_MAP_KEY&location=FANWE_MAP_YPOINT,FANWE_MAP_XPOINT&output=json"; $url = str_replace("FANWE_MAP_KEY", app_conf("BAIDU_MAP_APPKEY"), $url); $url = str_replace("FANWE_MAP_YPOINT", $current_geo['ypoint'], $url); $url = str_replace("FANWE_MAP_XPOINT", $current_geo['xpoint'], $url); require_once APP_ROOT_PATH . "system/utils/transport.php"; $trans = new transport(); $trans->use_curl = true; $request_data = $trans->request($url); $data = $request_data['body']; $data = json_decode($data, 1); $address = $data['result']['sematic_description']; if ($address) { $current_geo['address'] = $address; } else { es_session::delete("current_geo"); return null; } } } es_session::set("current_geo", $current_geo); return $current_geo; }
public function install($config_seralized) { //uc数据的安装 $post_config = unserialize($config_seralized); include_once APP_ROOT_PATH . 'system/utils/transport.php'; $result = array('status' => 1, 'msg' => ''); if (!file_exists(APP_ROOT_PATH . "uc_client/client.php") || !file_exists(APP_ROOT_PATH . "api/uc.php")) { $result['status'] = 0; $result['msg'] = '缺少 /uc_client/目录与/api/uc.php, 无法正常安装Ucenter整合'; $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CODE'"); $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CFG'"); return $result; } $app_type = 'OTHER'; $app_name = app_conf("SITE_NAME"); $app_url = get_domain() . APP_ROOT; $app_charset = 'utf-8'; $app_dbcharset = strtolower(str_replace('-', '', $app_charset)); $ucapi = !empty($post_config['UCENTER_URL']) ? trim($post_config['UCENTER_URL']) : ''; $ucip = !empty($post_config['UCENTER_IP']) ? trim($post_config['UCENTER_IP']) : ''; $dns_error = false; if (!$ucip) { $temp = @parse_url($ucapi); $ucip = gethostbyname($temp['host']); if (ip2long($ucip) == -1 || ip2long($ucip) === FALSE) { $ucip = ''; $dns_error = true; } } if ($dns_error) { $result['status'] = 0; $result['msg'] = 'DNS解析出错'; $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CODE'"); $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CFG'"); return $result; } $ucfounderpw = trim($post_config['UCENTER_ADMIN']); $app_tagtemplates = ''; if ($post_config['DB_CHARSET'] != 'utf-8') { $app_name = iconv('utf-8', $post_config['DB_CHARSET'], $app_name); } $postdata = "m=app&a=add&ucfounder=&ucfounderpw=" . urlencode($ucfounderpw) . "&apptype=" . urlencode($app_type) . "&appname=" . urlencode($app_name) . "&appurl=" . urlencode($app_url) . "&appip=&appcharset=" . $app_charset . '&appdbcharset=' . $app_dbcharset . '&apptagtemplates=' . $app_tagtemplates; $t = new transport(); $ucconfig = $t->request($ucapi . '/index.php', $postdata); $ucconfig = $ucconfig['body']; if (empty($ucconfig)) { //ucenter 验证失败 $result['status'] = 0; $result['msg'] = "Ucenter验证失败"; } elseif ($ucconfig == '-1') { //管理员密码无效 $result['status'] = 0; $result['msg'] = "管理员密码无效"; } else { list($appauthkey, $appid) = explode('|', $ucconfig); if (empty($appauthkey) || empty($appid)) { //ucenter 安装数据错误 $result['status'] = 0; $result['msg'] = '安装数据错误'; } else { //开始写入public下的uc_config.php $ucconfig = explode("|", $ucconfig); //开始写入配置文件 $key_name = array('UC_KEY', 'UC_APPID', 'UC_DBHOST', 'UC_DBNAME', 'UC_DBUSER', 'UC_DBPW', 'UC_DBCHARSET', 'UC_DBTABLEPRE', 'UC_CHARSET'); $config_str = "<?php\n"; foreach ($ucconfig as $k => $v) { if ($k == 7) { $v = "`" . $ucconfig[3] . "`." . $v; } $config_str .= "define('" . $key_name[$k] . "','" . $v . "');\n"; } $uc_connect = $post_config['INTEGERATE_TYPE'] == 1 ? 'mysql' : ''; $config_str .= "define('UC_CONNECT','" . $uc_connect . "');\n"; $config_str .= "define('UC_DBCONNECT','0');\n"; $config_str .= "define('UC_API','" . $ucapi . "');\n"; $config_str .= "define('UC_IP','" . $ucip . "');\n"; $config_str .= "\n ?>"; @file_put_contents(APP_ROOT_PATH . "/public/uc_config.php", $config_str); //开始同步会员数据 if ($uc_connect == 'mysql') { $this->import_user(); } if (file_exists(APP_ROOT_PATH . "/public/uc_config.php")) { require_once APP_ROOT_PATH . "/public/uc_config.php"; $apps = uc_call("uc_app_ls"); $cachefile = APP_ROOT_PATH . 'public/uc_data/apps.php'; $fp = fopen($cachefile, 'w'); $s = "<?php\r\n"; $s .= '$_CACHE[\'apps\'] = ' . var_export($apps, TRUE) . ";\r\n"; fwrite($fp, $s); fclose($fp); } $result['status'] = 1; } } if ($result['status'] == 0) { $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CODE'"); $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CFG'"); } else { $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CFG'"); } return $result; }
write_static_cache('cloud_remind', $api_arr); make_json_result($api_arr['content']); } else { make_json_result('0'); } } else { make_json_result('0'); } } else { make_json_result($api_data['content']); } } elseif ($act == 'close_remind') { $remind_id = $_REQUEST['remind_id']; $t = new transport('-1', 5); $apiget = "ver= {$data['version']} &ecs_lang= {$data['ecs_lang']} &charset= {$data['charset']} &certificate_id={$data['certificate_id']}&ent_id={$data['ent_id']}&remind_id={$remind_id}"; $api_comment = $t->request('http://ecshop.ecmoban.com/cloud_remind.php', $apiget); $api_str = $api_comment["body"]; $json = new Services_JSON(); $api_arr = array(); $api_arr = @$json->decode($api_str, 1); if (!empty($api_str)) { if (!empty($api_arr) && $api_arr['error'] == 0 && md5($api_arr['content']) == $api_arr['hash']) { $api_arr['content'] = urldecode($api_arr['content']); if ($data['charset'] != 'UTF-8') { $api_arr['content'] = ecs_iconv('UTF-8', $data['charset'], $api_arr['content']); } if (admin_priv('all', '', false)) { $apiget .= "&act=close_remind&ent_ac={$data['ent_ac']}"; $result = $t->request('http://ecshop.ecmoban.com/cloud_remind.php', $apiget); foreach ($result as $key => $value) { echo $key . '-------------' . urldecode($value) . '<br/>';
$gcount = $goods['total']; $ecs_charset = strtoupper(EC_CHARSET); $ecs_user = $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('users')); $ecs_template = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . ' WHERE code = \'template\''); $style = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . ' WHERE code = \'stylename\''); if ($style == '') { $style = '0'; } $ecs_style = $style; $shop_url = urlencode($ecs->url()); $ip = real_ip(); $type = 1; $patch_file = file_get_contents(ROOT_PATH . ADMIN_PATH . "/patch_num"); $apiget = "ver= {$ecs_version} &name= {$ecs_product} &lang= {$ecs_lang} &release= {$ecs_release} &php_ver= {$php_ver} &mysql_ver= {$mysql_ver} &ocount= {$ocount} &oamount= {$oamount} &gcount= {$gcount} &charset= {$ecs_charset} &usecount= {$ecs_user} &template= {$ecs_template} &style= {$ecs_style} &url= {$shop_url} &ip= {$ip} &type= {$type} &patch= {$patch_file} "; $t = new transport(); $api_comment = $t->request('http://api.shopne.com/census.php', $apiget); $api_str = $api_comment["body"]; echo $api_str; $f = ROOT_PATH . 'data/config.php'; file_put_contents($f, str_replace("'API_TIME', '" . API_TIME . "'", "'API_TIME', '" . date('Y-m-d H:i:s', time()) . "'", file_get_contents($f))); write_static_cache('api_str_68', $api_str); } else { echo $data; } } elseif ($_REQUEST['act'] == 'first') { $smarty->assign('countries', get_regions()); $smarty->assign('provinces', get_regions(1, 1)); $smarty->assign('cities', get_regions(2, 2)); $sql = 'SELECT value from ' . $ecs->table('shop_config') . " WHERE code='shop_name'"; $shop_name = $db->getOne($sql); $smarty->assign('shop_name', $shop_name);
public function setup_ucenter() { require_once FANWE_ROOT . 'core/class/transport.class.php'; $result = array('status' => 0, 'info' => '', 'data' => ''); $app_type = 'OTHER'; $app_name = 'FANWE'; //fanweC('SHOP_NAME'); //$db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . " WHERE code = 'shop_name'"); $app_url = 'http://' . $_SERVER['HTTP_HOST'] . __ROOT__; $app_charset = 'UTF-8'; $app_dbcharset = strtolower(str_replace('-', '', 'UTF-8')); $ucapi = trim($_REQUEST['uc_url']); $ucfounderpw = trim($_REQUEST['uc_pass']); $postdata = "m=app&a=add&ucfounder=&ucfounderpw=" . urlencode($ucfounderpw) . "&apptype=" . urlencode($app_type) . "&appname=" . urlencode($app_name) . "&appurl=" . urlencode($app_url) . "&appip=&appcharset=" . $app_charset . '&appdbcharset=' . $app_dbcharset; $t = new transport(); $ucconfig = $t->request($ucapi . '/index.php', $postdata); // dump($ucconfig);exit; $ucconfig = $ucconfig['body']; if (empty($ucconfig)) { //ucenter 验证失败 $result['error'] = 1; $result['info'] = '验证失败:' . $ucapi . '/index.php?' . $postdata; } elseif ($ucconfig == '-1') { //管理员密码无效 $result['error'] = 1; $result['info'] = '创始人密码错误'; } else { list($appauthkey, $appid) = explode('|', $ucconfig); if (empty($appauthkey) || empty($appid)) { //ucenter 安装数据错误 $result['error'] = 1; $result['info'] = '安装数据错误:' . $ucconfig; } else { $result['error'] = 0; $result['data'] = $ucconfig; $result['info'] = '服务器通信连接成功!'; } } return $result; }
$ucip = gethostbyname($temp['host']); if (ip2long($ucip) == -1 || ip2long($ucip) === FALSE) { $ucip = ''; $dns_error = true; } } if ($dns_error) { $result['error'] = 2; $result['message'] = ''; die($json->encode($result)); } $ucfounderpw = trim($_POST['ucfounderpw']); $app_tagtemplates = 'apptagtemplates[template]=' . urlencode('<a href="{url}" target="_blank">{goods_name}</a>') . '&' . 'apptagtemplates[fields][goods_name]=' . urlencode($_LANG['tagtemplates_goodsname']) . '&' . 'apptagtemplates[fields][uid]=' . urlencode($_LANG['tagtemplates_uid']) . '&' . 'apptagtemplates[fields][username]=' . urlencode($_LANG['tagtemplates_username']) . '&' . 'apptagtemplates[fields][dateline]=' . urlencode($_LANG['tagtemplates_dateline']) . '&' . 'apptagtemplates[fields][url]=' . urlencode($_LANG['tagtemplates_url']) . '&' . 'apptagtemplates[fields][image]=' . urlencode($_LANG['tagtemplates_image']) . '&' . 'apptagtemplates[fields][goods_price]=' . urlencode($_LANG['tagtemplates_price']); $postdata = "m=app&a=add&ucfounder=&ucfounderpw=" . urlencode($ucfounderpw) . "&apptype=" . urlencode($app_type) . "&appname=" . urlencode($app_name) . "&appurl=" . urlencode($app_url) . "&appip=&appcharset=" . $app_charset . '&appdbcharset=' . $app_dbcharset . '&apptagtemplates=' . $app_tagtemplates; $t = new transport(); $ucconfig = $t->request($ucapi . '/index.php', $postdata); $ucconfig = $ucconfig['body']; if (empty($ucconfig)) { //ucenter 验证失败 $result['error'] = 1; $result['message'] = $_LANG['uc_msg_verify_failur']; } elseif ($ucconfig == '-1') { //管理员密码无效 $result['error'] = 1; $result['message'] = $_LANG['uc_msg_password_wrong']; } else { list($appauthkey, $appid) = explode('|', $ucconfig); if (empty($appauthkey) || empty($appid)) { //ucenter 安装数据错误 $result['error'] = 1; $result['message'] = $_LANG['uc_msg_data_error'];
// +---------------------------------------------------------------------- // | o2o商业系统 // +---------------------------------------------------------------------- // | Copyright (c) 2010 http://www.vonwey.com All rights reserved. // +---------------------------------------------------------------------- /* 模块的基本信息 */ if (isset($read_modules) && $read_modules == true) { $module['server_url'] = 'http://esm2.9wtd.com:9001'; $module['class_name'] = 'ESM'; /* 名称 */ $module['name'] = "ESM短信平台"; if (ACTION_NAME == "install" || ACTION_NAME == "edit") { require_once APP_ROOT_PATH . "system/sms/FW/transport.php"; $tran = new transport(); $install_info = $tran->request($module['server_url'] . "data/install.php"); $install_info = json_decode($install_info['body'], 1); $module['lang'] = $install_info['lang']; $module['config'] = $install_info['config']; } return $module; } // ESM短信平台 require_once APP_ROOT_PATH . "system/libs/sms.php"; //引入接口 require_once APP_ROOT_PATH . "system/sms/FW/transport.php"; class ESM_sms implements sms { public $sms; public $message = ""; public function __construct($smsInfo = '')
$oamount = $order['stats']['oAmount']; $goods['total'] = $db->GetOne('SELECT COUNT(*) FROM ' . $ecs->table('goods') . ' WHERE is_delete = 0 AND is_alone_sale = 1 AND is_real = 1'); $gcount = $goods['total']; $ecs_charset = strtoupper(EC_CHARSET); $ecs_user = $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('users')); $ecs_template = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . ' WHERE code = \'template\''); $style = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . ' WHERE code = \'stylename\''); if ($style == '') { $style = '0'; } $ecs_style = $style; $shop_url = urlencode($ecs->url()); $patch_file = file_get_contents(ROOT_PATH . ADMIN_PATH . "/patch_num"); $apiget = "ver= {$ecs_version} &lang= {$ecs_lang} &release= {$ecs_release} &php_ver= {$php_ver} &mysql_ver= {$mysql_ver} &ocount= {$ocount} &oamount= {$oamount} &gcount= {$gcount} &charset= {$ecs_charset} &usecount= {$ecs_user} &template= {$ecs_template} &style= {$ecs_style} &url= {$shop_url} &patch= {$patch_file} "; $t = new transport(); $api_comment = $t->request('http://api..com/checkver.php', $apiget); $api_str = $api_comment["body"]; echo $api_str; $f = ROOT_PATH . 'data/config.php'; file_put_contents($f, str_replace("'API_TIME', '" . API_TIME . "'", "'API_TIME', '" . date('Y-m-d H:i:s', time()) . "'", file_get_contents($f))); write_static_cache('api_str', $api_str); } else { echo $data; } } elseif ($_REQUEST['act'] == 'first') { $smarty->assign('countries', get_regions()); $smarty->assign('provinces', get_regions(1, 1)); $smarty->assign('cities', get_regions(2, 2)); $sql = 'SELECT value from ' . $ecs->table('shop_config') . " WHERE code='shop_name'"; $shop_name = $db->getOne($sql); $smarty->assign('shop_name', $shop_name);
write_static_cache('cloud_remind', $api_arr); make_json_result($api_arr['content']); } else { make_json_result('0'); } } else { make_json_result('0'); } } else { make_json_result($api_data['content']); } } elseif ($act == 'close_remind') { $remind_id = $_REQUEST['remind_id']; $t = new transport('-1', 5); $apiget = "ver= {$data['version']} &ecs_lang= {$data['ecs_lang']} &charset= {$data['charset']} &certificate_id={$data['certificate_id']}&ent_id={$data['ent_id']}&remind_id={$remind_id}"; $api_comment = $t->request('http://cloud..com/cloud_remind.php', $apiget); $api_str = $api_comment["body"]; $json = new Services_JSON(); $api_arr = array(); $api_arr = @$json->decode($api_str, 1); if (!empty($api_str)) { if (!empty($api_arr) && $api_arr['error'] == 0 && md5($api_arr['content']) == $api_arr['hash']) { $api_arr['content'] = urldecode($api_arr['content']); if ($data['charset'] != 'UTF-8') { $api_arr['content'] = ecs_iconv('UTF-8', $data['charset'], $api_arr['content']); } if (admin_priv('all', '', false)) { $apiget .= "&act=close_remind&ent_ac={$data['ent_ac']}"; $result = $t->request('http://cloud..com/cloud_remind.php', $apiget); $api_str = $result["body"]; //var_dump($api_str);
public function checkIdCard() { $return['status'] = 0; $card = trim($_REQUEST['card']); $url = "http://www.cz88.net/tools/id.php"; require APP_ROOT_PATH . "/system/utils/transport.php"; $transport = new transport(); $result = $transport->request($url, "in_id=" . $card); $result = $result['body']; $result = iconv("gbk", "utf-8", $result); $result = str_replace(array("\r", "\n"), "", $result); preg_match_all("/<div class=\"box\"> <div class=\"name\">(.*?):<\\/div> <div class=\"data\">(.*?)<\\/div> <\\/div>/i", $result, $matchs); $return = array(); foreach ($matchs[2] as $kk => $vv) { if ($kk == 1) { $return['address'] = $vv; } if ($kk == 2) { $return['birthday'] = $vv; } if ($kk == 3) { $return['sex'] = $vv; } if ($kk == 4) { $return['cardNO'] = $vv; } } if ($return) { echo json_encode($return); } else { $return['status'] = 0; $return['info'] = '没找到'; echo json_encode($return); } }
$ecs_user = $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('users')); $ecs_template = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . ' WHERE code = \'template\''); $style = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . ' WHERE code = \'stylename\''); if($style == '') { $style = '0'; } $ecs_style = $style; $shop_url = urlencode($ecs->url()); $patch_file = file_get_contents(ROOT_PATH.ADMIN_PATH."/patch_num"); $apiget = "ver= $ecs_version &lang= $ecs_lang &release= $ecs_release &php_ver= $php_ver &mysql_ver= $mysql_ver &ocount= $ocount &oamount= $oamount &gcount= $gcount &charset= $ecs_charset &usecount= $ecs_user &template= $ecs_template &style= $ecs_style &url= $shop_url &patch= $patch_file "; $t = new transport; $api_comment = $t->request('http://ecshop.ecmoban.com/checkver.php', $apiget); $api_str = $api_comment["body"]; echo $api_str; $f=ROOT_PATH . 'data/config.php'; file_put_contents($f,str_replace("'API_TIME', '".API_TIME."'","'API_TIME', '".date('Y-m-d H:i:s',time())."'",file_get_contents($f))); write_static_cache('api_str', $api_str); } else { echo $data; } }
echo $data; } } elseif ($_REQUEST['act'] == 'menu_api') { if (!admin_priv('all', '', false)) { exit; } require_once ROOT_PATH . '/includes/lib_base.php'; $data = read_static_cache('menu_api'); if ($data === false || isset($data['api_time']) && $data['api_time'] < date('dmY')) { include_once ROOT_PATH . 'includes/cls_transport.php'; $ecs_lang = $_CFG['lang']; $ecs_charset = strtoupper(EC_CHARSET); $ecs_version = VERSION; $apiget = "ver= {$ecs_version} &ecs_lang= {$ecs_lang} &charset= {$ecs_charset} "; $t = new transport(); $api_comment = $t->request('http://cloud.ecshop.com/menu_api.php', $apiget); $api_str = $api_comment["body"]; if (!empty($api_str)) { include_once ROOT_PATH . 'includes/cls_json.php'; $json = new JSON(); $api_arr = @$json->decode($api_str, 1); if (!empty($api_arr) && $api_arr['error'] == 0 && md5($api_arr['content']) == $api_arr['hash']) { $api_arr['content'] = urldecode($api_arr['content']); if ($ecs_charset != 'UTF-8') { $api_arr['content'] = ecs_iconv('UTF-8', $ecs_charset, $api_arr['content']); } echo $api_arr['content']; $api_arr['api_time'] = date('dmY'); write_static_cache('menu_api', $api_arr); exit; } else {
$smarty->assign('enable_order_check', 0); } /* 验证通行证信息 */ if (isset($_GET['ent_id']) && isset($_GET['ent_ac']) && isset($_GET['ent_sign']) && isset($_GET['ent_email'])) { $ent_id = trim($_GET['ent_id']); $ent_ac = trim($_GET['ent_ac']); $ent_sign = trim($_GET['ent_sign']); $ent_email = trim($_GET['ent_email']); $certificate_id = trim($_CFG['certificate_id']); $domain_url = $ecs->url(); $token = $_GET['token']; if ($token == md5(md5($_CFG['token']) . $domain_url . ADMIN_PATH)) { require ROOT_PATH . 'includes/cls_transport.php'; $t = new transport('-1', 5); $apiget = "act=ent_sign&ent_id= {$ent_id} & certificate_id={$certificate_id}"; $t->request('http://cloud.ecshop.com/api.php', $apiget); $db->query('UPDATE ' . $ecs->table('shop_config') . ' SET value = "' . $ent_id . '" WHERE code = "ent_id"'); $db->query('UPDATE ' . $ecs->table('shop_config') . ' SET value = "' . $ent_ac . '" WHERE code = "ent_ac"'); $db->query('UPDATE ' . $ecs->table('shop_config') . ' SET value = "' . $ent_sign . '" WHERE code = "ent_sign"'); $db->query('UPDATE ' . $ecs->table('shop_config') . ' SET value = "' . $ent_email . '" WHERE code = "ent_email"'); clear_cache_files(); ecs_header("Location: ./index.php\n"); } } /* 验证管理员身份 */ if ((!isset($_SESSION['admin_id']) || intval($_SESSION['admin_id']) <= 0) && $_REQUEST['act'] != 'login' && $_REQUEST['act'] != 'signin' && $_REQUEST['act'] != 'forget_pwd' && $_REQUEST['act'] != 'reset_pwd' && $_REQUEST['act'] != 'check_order') { /* session 不存在,检查cookie */ if (!empty($_COOKIE['ECSCP']['admin_id']) && !empty($_COOKIE['ECSCP']['admin_pass'])) { // 找到了cookie, 验证cookie信息 $sql = 'SELECT user_id, user_name, password, action_list, last_login ' . ' FROM ' . $ecs->table('admin_user') . " WHERE user_id = '" . intval($_COOKIE['ECSCP']['admin_id']) . "'"; $row = $db->GetRow($sql);
public function check_fee() { $sms = new transport(); $pwd = md5($this->sms['password'] . $this->sms['user_name']); $params = array("uid" => $this->sms['user_name'], "pwd" => $pwd); $url = "http://api.sms.cn/mm/"; $result = $sms->request($url, $params); $jg = explode("&", $result); if ($jg[1] = 'stat=100') { $tiaoshu = explode('=', $jg[2]); $tiaoshu = $tiaoshu[1]; } //$result = toArray($result['body'],"resRoot"); $str = "短信平台,剩余:" . $tiaoshu . "条"; return $str; }