Server : Apache
System : Linux iZ2vcgyutqttsd1p850kl8Z 3.10.0-1160.92.1.el7.x86_64 #1 SMP Tue Jun 20 11:48:01 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 5.6.40
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Directory :  /www/wwwroot/saimikebio.com/mobile/include/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : /www/wwwroot/saimikebio.com/mobile/include/lib_bee.php
<?php



if (!defined('IN_ECTOUCH'))
{
    die('Hacking attempt');
}
 
function get_user_backorders ($user_id, $num = 10, $start = 0)
{
	/* 取得订单列表 */
	$arr = array();
	
	$sql = "SELECT bo.*, g.goods_name " . " FROM " . $GLOBALS['ecs']->table('back_order') . " AS bo left join " . $GLOBALS['ecs']->table('goods') . " AS g " . " on bo.goods_id=g.goods_id  " . " WHERE user_id = '$user_id' ORDER BY add_time DESC";
	$res = $GLOBALS['db']->SelectLimit($sql, $num, $start);
	
	while($row = $GLOBALS['db']->fetchRow($res))
	{
		
		$row['order_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']);
		$row['refund_money_1'] = price_format($row['refund_money_1'], false);
		
		$row['goods_url'] = build_uri('goods', array(
			'gid' => $row['goods_id']
		), $row['goods_name']);
		$row['status_back_1'] = $row['status_back'];
		$row['status_back'] = $GLOBALS['_LANG']['bos'][(($row['back_type'] == 4 && $row['status_back'] != 8) ? $row['back_type'] : $row['status_back'])] . ' - ' . $GLOBALS['_LANG']['bps'][$row['status_refund']];
		
		$arr[] = $row;
	}
	
	return $arr;
}

/**
 * ecshop 实现微信访问时自动授权登录
 *
 * @access  public
 */
function weixin_autologin()
{
	$phpself = $_SERVER["REQUEST_URI"];
    if(empty($_SESSION['user_id']) && is_wechat_browser() && file_exists(ROOT_PATH . 'include/website/config/weixin_config.php') && !strstr($phpself,'wechat') && (strstr($phpself,'index.php') || strstr($phpself,'category.php') || strstr($phpself,'goods.php') || strstr($phpself,'search.php') || strstr($phpself,'brand.php'))){
        $auto_url = $GLOBALS['ecs']->url().'user.php?act=oath&type=weixin';
		ecs_header("Location: $auto_url");
        exit;  
    }
}
function gb2py($text, $exp = '')
{ 
	if(!$text) return '';
	if(EC_CHARSET != 'gbk') $text = ecs_iconv(EC_CHARSET, 'gbk', $text);
	$data = array();
	$tmp = @file(ROOT_PATH . 'includes/codetable/gb-pinyin.table');
	if(!$tmp) return '';
	$tmps = count($tmp);
	for($i = 0; $i < $tmps; $i++) {
		$tmp1 = explode("	", $tmp[$i]);
		$data[$i]=array($tmp1[0], $tmp1[1]);
	}
	$r = array();
	$k = 0;
	$textlen = strlen($text);
	for($i = 0; $i < $textlen; $i++) {
		$p = ord(substr($text, $i, 1));		
		if($p > 160) {
			$q = ord(substr($text, ++$i, 1));
			$p = $p*256+$q-65536;
		}
        if($p > 0 && $p < 160) {
            $r[$k] = chr($p);
        } elseif($p< -20319 || $p > -10247) {
            $r[$k] = '';
        } else {
            for($j = $tmps-1; $j >= 0; $j--) {
                if($data[$j][1]<=$p) break;
            }
            $r[$k] = $data[$j][0];
        }
		$k++;
	}
	return implode($exp, $r);
}

function Recordkeyword($word_bee, $items = 0, $searchengine = 'ecshop')
{
	if(strlen($word_bee) < 3 || strlen($word_bee) > 30 || strpos($word_bee, ' ') !== false) return;
	$sql_bee = "SELECT * FROM " .$GLOBALS['ecs']->table('keyword'). " WHERE searchengine='ecshop' AND word='$word_bee'";
	$r = $GLOBALS['db']->getRow($sql_bee);
	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_bee = "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_bee);
		$w_id = $r['w_id'];
	}
	else
	{
		$letter_bee   = gb2py($word_bee);
		$sql_bee = "INSERT INTO " . $GLOBALS['ecs']->table('keyword') . " (searchengine, word, keyword, letter, items, updatetime, total_search, ".
		"month_search, week_search, today_search, status) " .
                " VALUES ('$searchengine', '$word_bee', '$word_bee', '$letter_bee', '$items', '".gmtime()."', '1', '1', '1', '1', '1')";
        $GLOBALS['db']->query($sql_bee);
		$w_id = $GLOBALS['db']->insert_id();
	}
	if (!empty($w_id))
	{
    	$ip_bee       = real_ip();
    	$area_bee     = ecs_geoip($ip);
    	$sql_bee = 'INSERT INTO ' . $GLOBALS['ecs']->table('keyword_area') . ' ( ' .
                'w_id, access_time, ip_address, area) VALUES (' .
                "'$w_id', '".gmtime()."', '$ip_bee', '$area_bee')";
    	$GLOBALS['db']->query($sql_bee);
	}
}

?>