Example #1
0
function &db()
{
    include_once 'db.php';
    static $db = null;
    if ($db === null) {
        $cfg = parse_url(DB_CONFIG);
        if ($cfg['scheme'] == 'mysql') {
            if (empty($cfg['pass'])) {
                $cfg['pass'] = '';
            } else {
                $cfg['pass'] = urldecode($cfg['pass']);
            }
            $cfg['user'] = urldecode($cfg['user']);
            if (empty($cfg['path'])) {
                trigger_error('Invalid database name.', E_USER_ERROR);
            } else {
                $cfg['path'] = str_replace('/', '', $cfg['path']);
            }
            $charset = 'utf8';
            $db = new cls_mysql();
            //$db->cache_dir = ROOT_PATH. '/temp/query_caches/';
            $db->connect($cfg['host'] . ':' . $cfg['port'], $cfg['user'], $cfg['pass'], $cfg['path'], $charset);
        } else {
            trigger_error('Unkown database type.', E_USER_ERROR);
        }
    }
    return $db;
}
Example #2
0
function get_waterMark()
{
    require_once ROOT_PATH . '/data/config.php';
    require_once ROOT_PATH . '/includes/cls_mysql.php';
    $db = new cls_mysql($db_host, $db_user, $db_pass, $db_name, EC_CHARSET, 0, 1);
    $sql = 'select value from ecs_shop_config where code = "watermark"';
    $watermark = $db->getOne($sql);
    $sql = 'select value from ecs_shop_config where code = "watermark_place"';
    $watermark_place = $db->getOne($sql);
    $sql = 'select value from ecs_shop_config where code = "watermark_alpha"';
    $watermark_alpha = $db->getOne($sql);
    return array('watermark' => $watermark, 'watermark_place' => $watermark_place, 'watermark_alpha' => $watermark_alpha);
}
Example #3
0
function addTongji($domain, $ip)
{
    global $db, $db_host, $db_user, $db_pass, $db_name, $prefix;
    $ecs = new ECS($db_name, $prefix);
    $db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
    list($dom, $domainname, $ext) = explode('.', $domain);
    $domainname .= '.' . $ext;
    $namemd5 = md5($domainname);
    $userip = $ip;
    try {
        $sql = 'INSERT INTO ' . $ecs->table('userinfo') . ' (`domain_name`, `name_md5`, `addtime`, `userip`, `userpv`) VALUES ("' . $domainname . '","' . $namemd5 . '",' . time() . ',"' . $userip . '",0) ON DUPLICATE KEY UPDATE userpv=userpv+1';
        $db->query($sql);
        return '1';
    } catch (Exception $e) {
        return '0';
    }
}
Example #4
0
/**
 *    数据库控制器
 *
 *    @author    Hyber
 *    @usage    none
 */
function dump_escape_string($str)
{
    if ($str === null) {
        return null;
    } else {
        if ($str == '') {
            return '';
        } else {
            return cls_mysql::escape_string($str);
        }
    }
}
Example #5
0
<?php

error_reporting(0);
//error_reporting(2047);
define('M_COM', TRUE);
define('M_ROOT', '');
$timestamp = time();
include_once M_ROOT . './base.inc.php';
include_once M_ROOT . './include/general.fun.php';
load_cache('sitemaps');
empty($sitemaps['google']) && exit;
$sitemap = $sitemaps['google'];
$cachefile = M_ROOT . './google.xml';
if (empty($sitemap['setting']['life']) || $timestamp - @filemtime($cachefile) > $sitemap['setting']['life'] * 3600 || !($datastr = file2str($cachefile))) {
    require M_ROOT . './dynamic/cache/mconfigs.cac.php';
    @extract($mconfigs_0);
    include_once M_ROOT . './include/mysql.cls.php';
    $db = new cls_mysql();
    $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);
    include_once M_ROOT . './include/common.fun.php';
    include_once M_ROOT . './include/sitemap.inc.php';
    str2file($datastr, $cachefile);
}
echo $datastr;
header("Content-type: application/xml");
exit;
Example #6
0
    }
    $_COOKIE = addslashes_deep($_COOKIE);
    $_REQUEST = addslashes_deep($_REQUEST);
}
/* 对路径进行安全处理 */
if (strpos(PHP_SELF, '.php/') !== false) {
    ecs_header("Location:" . substr(PHP_SELF, 0, strpos(PHP_SELF, '.php/') + 4) . "\n");
    exit;
}
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', $ecs->data_dir());
define('IMAGE_DIR', $ecs->image_dir());
/* 初始化数据库类 */
require ROOT_PATH . 'includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 创建错误处理对象 */
$err = new ecs_error('message.htm');
/* 初始化session */
require ROOT_PATH . 'includes/cls_session.php';
$sess = new cls_session($db, $ecs->table('sessions'), $ecs->table('sessions_data'), 'ECSCP_ID');
/* 初始化 action */
if (!isset($_REQUEST['act'])) {
    $_REQUEST['act'] = '';
} elseif (($_REQUEST['act'] == 'login' || $_REQUEST['act'] == 'logout' || $_REQUEST['act'] == 'signin') && strpos(PHP_SELF, '/privilege.php') === false) {
    $_REQUEST['act'] = '';
} elseif (($_REQUEST['act'] == 'forget_pwd' || $_REQUEST['act'] == 'reset_pwd' || $_REQUEST['act'] == 'get_pwd') && strpos(PHP_SELF, '/get_password.php') === false) {
    $_REQUEST['act'] = '';
}
/* 载入系统参数 */
Example #7
0
     $userinfos['password'] = md5($userdb['password']);
     $userinfos['email'] = addslashes($userdb['email']);
     $ckinfos['time'] = $userdb['time'];
 }
 $userinfos['mname'] = preg_replace("/(c:\\con\\con\$|[%,\\*\"\\s\t\\<\\>\\&])/i", "", $userinfos['mname']);
 if (strlen($userinfos['mname']) > 15) {
     $userinfos['mname'] = substr($userinfos['mname'], 0, 15);
 }
 if (empty($ckinfos['time']) || empty($userinfos['mname']) || empty($userinfos['password'])) {
     empty($_GET['forward']) || header("Location: {$_GET['forward']}");
     exit('member data missing!');
 } elseif ($timestamp - $ckinfos['time'] > $pptin_expire) {
     empty($_GET['forward']) || header("Location: {$_GET['forward']}");
     exit('member data expired!');
 }
 $db = new cls_mysql();
 $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);
 if ($cmember = $db->fetch_one("SELECT mid,checked FROM {$tblprefix}members WHERE mname='{$userinfos['mname']}'")) {
     $cmember['password'] != $userinfos['password'] && $db->query("UPDATE {$tblprefix}members SET password='******'password']}' WHERE mid={$cmember['mid']}");
     msetcookie('msid', '', -86400 * 365);
     msetcookie('userauth', authcode("{$userinfos['password']}\t{$cmember['mid']}", 'ENCODE'));
 } else {
     //只是写入会员资料记录,当第一次登录时需要激活,将checked设为2。
     $sqlstr = '';
     $userinfos['regip'] = empty($userinfos['regip']) ? onlineip() : $userinfos['regip'];
     $userinfos['regdate'] = empty($userinfos['regdate']) ? $timestamp : $userinfos['regdate'];
     foreach (array('mname', 'password', 'email', 'regip', 'regdate') as $var) {
         $sqlstr .= (empty($sqlstr) ? '' : ',') . "{$var}='{$userinfos[$var]}'";
     }
     $sqlstr .= ",checked='2'";
     $db->query("INSERT INTO {$tblprefix}members SET {$sqlstr}");
Example #8
0
/**
 * 获得spt代码
 *
 * @access  public
 * @return  string   spt代码
 */
function get_spt_code()
{
    include(ROOT_PATH . 'data/config.php');
    include_once(ROOT_PATH . 'includes/cls_ecshop.php');
    include_once(ROOT_PATH . 'includes/cls_mysql.php');
    $db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
    $ecs = new ECS($db_name, $prefix);
    $hash_code = $db->getOne("SELECT value FROM " . $ecs->table('shop_config') . " WHERE code='hash_code'");
    $spt = '<script type="text/javascript" src="http://api.ecshop.com/record.php?';
    $spt .= "url=" .urlencode($ecs->url()). "&mod=install&version=" .VERSION. "&hash_code=" . $hash_code . "&charset=" .EC_CHARSET. "&language=" . $GLOBALS['installer_lang'] . "\"></script>";

    return $spt;
}
Example #9
0
     $sysmsg[] = __('uc_dbtablepre_error');
 }
 if (!trim($settings['uc_key'])) {
     $error = true;
     $sysmsg[] = __('uc_key_error');
 }
 if (!trim($settings['uc_api'])) {
     $error = true;
     $sysmsg[] = __('uc_api_error');
 }
 if (!$settings['uc_appid']) {
     $error = true;
     $sysmsg[] = __('uc_appid_error');
 }
 if ($settings['connect_uc'] && !$error) {
     $dbuc = new cls_mysql();
     $dbuc->connect($settings['uc_dbhost'], $settings['uc_dbuser'], $settings['uc_dbpwd'], $settings['uc_dbname'], $settings['uc_pconnect']);
     $username = @$dbuc->result_first("select username from `{$settings['uc_dbname']}`.{$settings['uc_dbtablepre']}members where username='******'uc_admin']}' limit 1");
     if ($q) {
         $dbuc->free($q);
     }
     $dbuc->close();
     if (!$username) {
         $error = true;
         $sysmsg[] = __('uc_admin_error');
     }
 }
 if (!$error) {
     $charset_arr = array('gbk' => 'gbk', 'utf-8' => 'utf8');
     $settings['uc_dbcharset'] = $charset_arr[strtolower($settings['uc_charset'])];
     settings_cache($settings);
Example #10
0
}
/* 初始化JSON对象 */
$json = new JSON();
/* 分析JSON数据 */
parse_json($json, $_POST['Json']);
/* 初始化包含文件 */
require ROOT_PATH . 'includes/inc_constant.php';
require ROOT_PATH . 'includes/cls_ecshop.php';
require ROOT_PATH . 'includes/lib_time.php';
require ROOT_PATH . 'includes/lib_main.php';
require ROOT_PATH . 'includes/lib_insert.php';
require ROOT_PATH . 'includes/lib_goods.php';
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
/* 初始化数据库类 */
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db->set_disable_cache_tables(array($ecs->table('sessions'), $ecs->table('sessions_data'), $ecs->table('cart')));
$db_host = $db_user = $db_pass = $db_name = null;
/* 载入系统参数 */
$_CFG = load_config();
/* 载入语言包 */
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/common.php';
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/log_action.php';
/* 初始化session */
include ROOT_PATH . 'includes/cls_session.php';
$sess = new cls_session($db, $ecs->table('sessions'), $ecs->table('sessions_data'), 'CL_ECSCP_ID');
define('SESS_ID', $sess->get_session_id());
/* 判断是否登录了 */
if ((!isset($_SESSION['admin_id']) || intval($_SESSION['admin_id']) <= 0) && $_POST['Action'] != 'UserLogin') {
    client_show_message(110);
}
Example #11
0
    }
    $_COOKIE = addslashes_deep($_COOKIE);
    $_REQUEST = addslashes_deep($_REQUEST);
}
/* 对路径进行安全处理 */
if (strpos(PHP_SELF, '.php/') !== false) {
    ecs_header("Location:" . substr(PHP_SELF, 0, strpos(PHP_SELF, '.php/') + 4) . "\n");
    exit;
}
/* 创建 ECSHOP 对象  TODO*/
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', $ecs->data_dir());
define('IMAGE_DIR', $ecs->image_dir());
/* 初始化数据库类 */
require ROOT_PATH . 'includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 创建错误处理对象 */
$err = new ecs_error('message.htm');
/* 初始化session */
require ROOT_PATH . 'includes/cls_session.php';
$sess = new cls_session($db, $ecs->table('sessions'), $ecs->table('sessions_data'), 'ECSCP_ID');
/* 载入系统参数 */
// $_CFG = load_config();
$_CFG = array("lang" => "zh_cn", "template" => "default", "hash_code" => "feb0af8dda696ecc1a9ba790973096a8", "captcha" => "0");
/* 初始化 action */
if (!isset($_REQUEST['act'])) {
    $_REQUEST['act'] = '';
}
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/common.php';
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/log_action.php';
Example #12
0
 $dsid = empty($dsid) ? 0 : max(0, intval($dsid));
 $dbtable = empty($dbtable) ? '' : trim($dbtable);
 if ($dsid && empty($dbsources[$dsid])) {
     amessage('choosedbs', $forward);
 }
 if (!$dsid) {
     $ndb =& $db;
     $dbsource['cname'] = lang('current_system');
     $dbsource['dbname'] = $dbname;
 } else {
     $dbsource = $dbsources[$dsid];
     $dbsource['dbpw'] && ($dbsource['dbpw'] = authcode($dbsource['dbpw'], 'DECODE', md5($authkey)));
     if (empty($dbsource['cname']) || empty($dbsource['dbhost']) || empty($dbsource['dbuser']) || empty($dbsource['dbname'])) {
         amessage('dbdatamis');
     }
     $ndb = new cls_mysql();
     if (!$ndb->connect($dbsource['dbhost'], $dbsource['dbuser'], $dbsource['dbpw'], $dbsource['dbname'], 0, false, $dbsource['dbcharset'])) {
         amessage('dbconerr');
     }
 }
 $dbtables = array('' => lang('select_table'));
 $query = $ndb->query("SHOW TABLES FROM {$dbsource['dbname']}");
 while ($v = $ndb->fetch_row($query)) {
     $dbtables[$v[0]] = $v[0];
 }
 $dsidsarr = array(0 => lang('current_system'));
 foreach ($dbsources as $k => $v) {
     $dsidsarr[$k] = $v['cname'];
 }
 $filterbox = lang('choose_db_src') . '&nbsp; :&nbsp; ';
 $filterbox .= "<select style=\"vertical-align: middle;\" name=\"dsid\" onchange=\"redirect('?entry=dbsources&action=viewconfigs&dsid=' + this.options[this.selectedIndex].value);\">";
Example #13
0
    echo '<script language="javascript" reload="1">alert(\'' . addslashes($checkmsg) . '\');parent.$(\'cfupload\').action=\'?entry=mconfigs&action=cfupload\';parent.$(\'cfupload\').target=\'_self\'</script>';
} elseif ($action == 'dbcheck') {
    $checkmsg = '';
    $dbsourcenew = mstripslashes($dbsourcenew);
    if (in_str('********', $dbsourcenew['dbpw'])) {
        $dbsourcenew['dbpw'] = authcode($dbsourcenew['dbpw0'], 'DECODE', md5($authkey));
    }
    $alertarr = array('add' => array('dbsourceadd', 'dbsourcesedit'), 'edit' => array('dbsourcedetail', 'dbsourcedetail'));
    $dbsourcenew['cname'] = trim(strip_tags($dbsourcenew['cname']));
    $dbsourcenew['dbhost'] = trim(strip_tags($dbsourcenew['dbhost']));
    $dbsourcenew['dbuser'] = trim(strip_tags($dbsourcenew['dbuser']));
    $dbsourcenew['dbname'] = trim(strip_tags($dbsourcenew['dbname']));
    if (empty($dbsourcenew['cname']) || empty($dbsourcenew['dbhost']) || empty($dbsourcenew['dbuser']) || empty($dbsourcenew['dbname'])) {
        $checkmsg = lang('dbsrc_data_miss');
    } else {
        $s_db = new cls_mysql();
        if (!$s_db->connect($dbsourcenew['dbhost'], $dbsourcenew['dbuser'], $dbsourcenew['dbpw'], $dbsourcenew['dbname'], 0, false, $dbsourcenew['dbcharset'])) {
            $checkmsg = lang('dbsrc_connect_error');
        } else {
            $checkmsg = lang('dbsrc_connect_correct');
        }
        $s_db->close();
    }
    echo '<script language="javascript" reload="1">alert(\'' . addslashes($checkmsg) . '\');parent.$(\'' . $alertarr[$deal][0] . '\').action=\'?entry=dbsources&action=' . $alertarr[$deal][1] . '\';parent.$(\'' . $alertarr[$deal][0] . '\').target=\'_self\'</script>';
} elseif ($action == 'mailcheck') {
    $mail_to = trim($mconfigsnew['mail_to']);
    $mail_sign = trim($mconfigsnew['mail_sign']);
    $mail_smtp = trim($mconfigsnew['mail_smtp']);
    $mail_mode = trim($mconfigsnew['mail_mode']);
    $mail_port = trim($mconfigsnew['mail_port']);
    $mail_auth = trim($mconfigsnew['mail_auth']);
/**
 * 创建管理员帐号
 *
 * @access  public
 * @param   string      $admin_name
 * @param   string      $admin_password
 * @param   string      $admin_password2
 * @param   string      $admin_email
 * @return  boolean     成功返回true,失败返回false
 */
function create_admin_passport($db_host, $db_user, $db_pass, $db_name, $admin_name, $admin_password, $admin_password2)
{
    include_once ROOT_PATH . 'tools/controllers/includes/cls_mysql.php';
    include_once ROOT_PATH . 'tools/controllers/includes/lib_common.php';
    $db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
    $sql = "INSERT INTO svsys_operators" . "(name,password, created, actions,status)" . "VALUES " . "('{$admin_name}','" . md5($admin_password) . "', " . gmtime() . ", 'all','1')";
    $result = $db->query($sql, 'SILENT');
    if (!empty($result) && $result === false) {
        return false;
    }
    return true;
}
Example #15
0
 if (empty($_POST['blogname'])) {
     $error[] = '请填写博客名字';
 }
 if ($error) {
     echo '<p class="line">错误信息</p>';
     foreach ($error as $val) {
         echo "<p>{$val}</p>";
     }
     exit;
 }
 $dbhost = $_POST['host'];
 $dbuser = $_POST['dbuser'];
 $dbpw = $_POST['dbpass'];
 $dbname = $_POST['dbname'];
 $charset = 'utf8';
 $db = new cls_mysql();
 if ($db->connect($dbhost, $dbuser, $dbpw, $dbname, $charset, $pconnect)) {
     $error[] = '数据库连接错误';
 }
 if (empty($_POST['dbprefix'])) {
     $dbprefix = 'fb_';
 } else {
     $dbprefix = $_POST['dbprefix'];
 }
 $admin_user = $_POST['admin_user'];
 $admin_pass = $_POST['admin_pass'];
 $blogname = $_POST['blogname'];
 $blogdesc = $_POST['blogdesc'];
 $blog_keyword = $_POST['blogkeyword'];
 $domain = dirname(url());
 $domain = str_replace("install", '', $domain);
Example #16
0
File: init.php Project: dlpc/ecshop
    if (!empty($_GET)) {
        $_GET = addslashes_deep($_GET);
    }
    if (!empty($_POST)) {
        $_POST = addslashes_deep($_POST);
    }
    $_COOKIE = addslashes_deep($_COOKIE);
    $_REQUEST = addslashes_deep($_REQUEST);
}
/* 创建  对象 */
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', $ecs->data_dir());
define('IMAGE_DIR', $ecs->image_dir());
/* 初始化数据库类 */
require ROOT_PATH . 'includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db->set_disable_cache_tables(array($ecs->table('sessions'), $ecs->table('sessions_data'), $ecs->table('cart')));
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 创建错误处理对象 */
$err = new ecs_error('message.dwt');
/* 载入系统参数 */
$_CFG = load_config();
/* 当前网站地址 */
$present_url = agency_url();
#####   配置信息(放至所有配置网站一些信息)   #####################
$_CFG['o2o_img_url'] = 'http://' . $present_url;
//.'/o2o/'
define('TMUSER', 'o2o');
/*配置天猫过来的用户名前缀*/
/* 网站图片地址 */
$img_arr = array('http://img1.txd168.com', 'http://img2.txd168.com', 'http://img3.txd168.com');
Example #17
0
    </p>
    <p><h4>璇峰厛鍗囩骇鎮ㄧ殑绋嬪簭鍐嶈繘琛屽?鍏ャ€侟/h4></p>
EOT;
    instfooter();
} elseif ($step == 'start') {
    $limit = getgpc('limit', 'P');
    $update = getgpc('update', 'P');
    $insert = getgpc('insert', 'P');
    $success = getgpc('success', 'P');
    $error = getgpc('error', 'P');
    $item_num = 500; // 姣忔?澶勭悊1000涓?細鍛樻暟鎹
    $statistics = array('update' => 0, 'insert' => 0, 'success' => 0, 'error' => 0);
    if (empty($limit)) {
        $limit = 0;
    }
    $uc_db = new cls_mysql(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET, 0, 1);
    $total_members = $uc_db->getOne("SELECT COUNT(*) FROM ". UC_DBTABLEPRE ."members");
    $sql = "SELECT uid, username, password, email, salt FROM ". UC_DBTABLEPRE ."members ORDER BY uid ASC LIMIT $limit, $item_num";
    $uc_query = $uc_db->query($sql);
    while($member = $uc_db->fetch_array($uc_query)){
        $user_exists = $db->getOne("SELECT COUNT(*) FROM {$prefix}users WHERE `user_name`='{$member['username']}'");
        if (!$user_exists) {
            $sql = "INSERT INTO {$prefix}users (`email`, `user_name`, `password`, `salt`) VALUES('{$member['email']}', '{$member['username']}', '{$member['password']}', '2{$member['salt']}')";
            ++$statistics['insert'];
        } else {
            $sql = "UPDATE {$prefix}users SET `password`='{$member['password']}', `salt`='2{$member['salt']}' WHERE `user_name`='{$member['username']}'";
            ++$statistics['update'];
        }
        $db->query($sql);
        if ($db->affected_rows() > 0) {
            ++$statistics['success'];
Example #18
0
    }
    if (!empty($_POST)) {
        $_POST = addslashes_deep($_POST);
    }
    $_COOKIE = addslashes_deep($_COOKIE);
    $_REQUEST = addslashes_deep($_REQUEST);
}
/* 对路径进行安全处理 */
if (strpos(PHP_SELF, '.php/') !== false) {
    los_header("Location:" . substr(PHP_SELF, 0, strpos(PHP_SELF, '.php/') + 4) . "\n");
    exit;
}
/* 初始化数据库类 */
require ROOT_PATH . 'includes/cls_mysql.php';
$db_write = new cls_mysql($my_db_host_write, $my_db_user_write, $my_db_pass_write, $my_db_name_write);
$db_read = new cls_mysql($my_db_host_read, $my_db_user_read, $my_db_pass_read, $my_db_name_read);
/* 初始化 action */
if (!isset($_REQUEST['act'])) {
    $_REQUEST['act'] = '';
} elseif (($_REQUEST['act'] == 'login' || $_REQUEST['act'] == 'logout' || $_REQUEST['act'] == 'signin') && strpos(PHP_SELF, '/privilege.php') === false) {
    $_REQUEST['act'] = '';
} elseif (($_REQUEST['act'] == 'forget_pwd' || $_REQUEST['act'] == 'reset_pwd' || $_REQUEST['act'] == 'get_pwd') && strpos(PHP_SELF, '/get_password.php') === false) {
    $_REQUEST['act'] = '';
}
if (!file_exists('temp/caches')) {
    @mkdir('temp/caches', 0777);
    @chmod('temp/caches', 0777);
}
if (!file_exists('temp/compiled')) {
    @mkdir('temp/compiled', 0777);
    @chmod('temp/compiled', 0777);
Example #19
0
    /* 包含插件语言文件 */
    include_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/convert/' . $config->code . '.php';
    /* 取得第一步操作 */
    $step = $convert->next_step('');
    /* 返回 */
    make_json_result($step, $_LANG[$step]);
} elseif ($_REQUEST['act'] == 'process') {
    /* 设置执行时间 */
    set_time_limit(0);
    /* 检查权限 */
    check_authz_json('all');
    /* 取得参数 */
    $step = json_str_iconv($_POST['step']);
    /* 连接原数据库 */
    $config = $_SESSION['convert_config'];
    $sdb = new cls_mysql($config->host, $config->user, $config->pass, $config->db);
    $sdb->set_mysql_charset($config->charset);
    /* 创建插件对象 */
    include_once ROOT_PATH . 'includes/modules/convert/' . $config->code . '.php';
    $convert = new $config->code($sdb, $config->prefix, $config->path, $config->charset);
    /* 包含插件语言文件 */
    include_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/convert/' . $config->code . '.php';
    /* 执行步骤 */
    $result = $convert->process($step);
    if ($result !== true) {
        make_json_error($result);
    }
    /* 取得下一步操作 */
    $step = $convert->next_step($step);
    /* 返回 */
    make_json_result($step, empty($_LANG[$step]) ? '' : $_LANG[$step]);
Example #20
0
        $_GET = addslashes_deep($_GET);
    }
    if (!empty($_POST)) {
        $_POST = addslashes_deep($_POST);
    }
    $_COOKIE = addslashes_deep($_COOKIE);
    $_REQUEST = addslashes_deep($_REQUEST);
}
define('REMOTE_ADDR', $_SERVER['REMOTE_ADDR']);
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', $ecs->data_dir());
define('IMAGE_DIR', $ecs->image_dir());
/* 初始化数据库类 */
require ROOT_PATH . 'include/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db->set_disable_cache_tables(array($ecs->table('sessions'), $ecs->table('sessions_data'), $ecs->table('cart')));
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 创建错误处理对象 */
$err = new ecs_error('message.dwt');
/* 载入系统参数 */
$_CFG = load_config();
$_CFG['URL_HTTP_HOST'] = $config['site_url'];
/* 载入语言文件 */
require ROOT_PATH . 'lang/' . $_CFG['lang'] . '/common.php';
if ($_CFG['shop_closed'] == 1) {
    /* 商店关闭了,输出关闭的消息 */
    header('Content-type: text/html; charset=' . EC_CHARSET);
    die('<div style="margin: 150px; text-align: center; font-size: 14px"><p>' . $_LANG['shop_closed'] . '</p><p>' . $_CFG['close_comment'] . '</p></div>');
}
if (is_spider()) {
Example #21
0
/**
 * 对mysql敏感字符串转义
 *
 * @access  public
 * @param   string      $str
 *
 * @return string
 */
function dump_escape_string($str)
{
    return cls_mysql::escape_string($str);
}
Example #22
0
if (!get_magic_quotes_gpc()) {
    if (!empty($_GET)) {
        $_GET = addslashes_deep($_GET);
    }
    if (!empty($_POST)) {
        $_POST = addslashes_deep($_POST);
    }
    $_COOKIE = addslashes_deep($_COOKIE);
    $_REQUEST = addslashes_deep($_REQUEST);
}
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', '/' . $ecs->data_dir());
/* 初始化数据库类 */
require ROOT_PATH . 'includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db_host = $db_user = $db_pass = $db_name = NULL;
$yhcwebsite = "http://weixin.dream-gardens.com.cn/";
$yhctestdb = new cls_mysql("112.124.110.58", "root", "dream@sh123data", "yhctest");
/* 创建错误处理对象 */
$err = new ecs_error('message.dwt');
/* 载入系统参数 */
$_CFG = load_config();
/* 初始化session */
require ROOT_PATH . 'includes/cls_session.php';
$sess = new cls_session($db, $ecs->table('sessions'), $ecs->table('sessions_data'), 'ecsid');
define('SESS_ID', $sess->get_session_id());
if (!defined('INIT_NO_SMARTY')) {
    header('Cache-control: private');
    header('Content-type: text/html; charset=utf-8');
    /* 创建 Smarty 对象。*/
Example #23
0
             $smarty->assign('noucdb', true);
         } else {
             @mysql_close($link);
             $ucdb = new cls_mysql(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET);
             $maxuid = intval($ucdb->getOne("SELECT MAX(uid)+1 FROM " . UC_DBTABLEPRE . "members LIMIT 1"));
             $smarty->assign('maxuid', $maxuid);
         }
     }
     $smarty->display('usermerge.php');
     break;
     /*将会员数据导入到uc*/
 /*将会员数据导入到uc*/
 case 'userimporttouc':
     include ROOT_PATH . 'data/config.php';
     include_once ROOT_PATH . 'includes/cls_json.php';
     $ucdb = new cls_mysql(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET);
     $json = new JSON();
     $result = array('error' => 0, 'message' => '');
     $maxuid = intval($ucdb->getOne("SELECT MAX(uid)+1 FROM " . UC_DBTABLEPRE . "members LIMIT 1"));
     $merge_method = intval($_POST['merge']);
     $merge_uid = array();
     $uc_uid = array();
     $repeat_user = array();
     $query = $db->query("SELECT * FROM " . $ecs->table('users') . " ORDER BY `user_id` ASC");
     while ($data = $db->fetch_array($query)) {
         $salt = rand(100000, 999999);
         $password = md5($data['password'] . $salt);
         $data['username'] = addslashes($data['user_name']);
         $lastuid = $data['user_id'] + $maxuid;
         $uc_userinfo = $ucdb->getRow("SELECT `uid`, `password`, `salt` FROM " . UC_DBTABLEPRE . "members WHERE `username`='{$data['username']}'");
         if (!$uc_userinfo) {
Example #24
0
    }
} else {
    $class_code = $_SESSION["class_code"];
}
if ($school_code == 'super' || $class_code == 'super') {
    clearstatcache();
    ecs_header("Location: ../login.php\n");
    exit;
}
$db_name = $school_code . "_school";
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', $ecs->data_dir());
define('IMAGE_DIR', $ecs->image_dir());
/*重新连接数据库*/
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 初始化 action */
if (!isset($_REQUEST['act'])) {
    $_REQUEST['act'] = 'list';
}
/* 载入系统参数 */
$_CFG = load_config();
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/common.php';
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/log_action.php';
if (file_exists(ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/' . basename(PHP_SELF))) {
    include ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/' . basename(PHP_SELF);
}
if (!file_exists('../temp/caches')) {
    @mkdir('../temp/caches', 0777);
    @chmod('../temp/caches', 0777);
Example #25
0
require ROOT_PATH . "includes/Smarty.class.php";
if (!get_magic_quotes_gpc()) {
    if (!empty($_GET)) {
        $_GET = addslashes_deep($_GET);
    }
    if (!empty($_POST)) {
        $_POST = addslashes_deep($_POST);
    }
    $_COOKIE = addslashes_deep($_COOKIE);
    $_REQUEST = addslashes_deep($_REQUEST);
}
if (PHP_VERSION >= '5.1' && !empty($timezone)) {
    date_default_timezone_set($timezone);
}
require ROOT_PATH . 'includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_password, $db_name);
$db_host = $db_user = $db_password = $db_name = NULL;
$smarty = new Smarty();
$smarty->debugging = false;
$smarty->caching = 2;
$smarty->config_load('xjoj.conf');
$login_user = array();
session_start();
ob_start();
if (isset($_COOKIE['user_id']) && !empty($_COOKIE['user_id'])) {
    $sql = "select * from author where password='******'password']}' and user_id='{$_COOKIE['user_id']}'";
    //使用建立缓存的sql查询
    $login_user = $db->getRow($sql);
    if (empty($login_user['user_id'])) {
        setcookie('user_id', '');
        setcookie('password', '');
Example #26
0
    echo "<tr class=\"header\"><td colspan=\"2\">" . ilang('add founder') . "</td></tr>\n";
    trbasic(array(ilang('founder account'), input_str('username', $username, 'text', 30, 0, 15)), 0);
    trbasic(array(ilang('founder email'), input_str('email', $email, 'text', 30)), 0);
    trbasic(array(ilang('founder password'), input_str('password1', $password1, 'password', 30, 0, 15)), 0);
    trbasic(array(ilang('reinput founder password'), input_str('password2', $password2, 'password', 30, 0, 15)), 0);
    echo "</table>\n";
    ins_mider();
    hidden_str('step', 6);
    button_str('submit', ilang('continue'));
    ins_footer(1);
    $ierror && ins_message($ierror);
} elseif ($step == '7') {
    $username = htmlspecialchars($_GET['username']);
    $email = htmlspecialchars($_GET['email']);
    $password = htmlspecialchars($_GET['password']);
    $db = new cls_mysql();
    $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);
    $db->select_db($dbname);
    $fp = fopen($sqlfile, 'rb');
    $sql = fread($fp, filesize($sqlfile));
    fclose($fp);
    ins_header();
    ?>
<script type="text/javascript">
	function showmessage(message) {
		document.getElementById('notice').value += message + "\r\n";
	}
</script>
<table width="100%" cellspacing="0" border="0" align="center">
<tr><td align="center"><br />
<textarea name="notice" style="width: 80%; height: 400px" readonly id="notice"></textarea>
Example #27
0
        $_GET = addslashes_deep($_GET);
    }
    if (!empty($_POST)) {
        $_POST = addslashes_deep($_POST);
    }
    $_COOKIE = addslashes_deep($_COOKIE);
    $_REQUEST = addslashes_deep($_REQUEST);
}
//$db_name = 'mescake';
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', $ecs->data_dir());
define('IMAGE_DIR', $ecs->image_dir());
/* 初始化数据库类 */
require ROOT_PATH . 'includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db->set_disable_cache_tables(array($ecs->table('sessions'), $ecs->table('sessions_data'), $ecs->table('cart')));
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 创建错误处理对象 */
$err = new ecs_error('message.dwt');
/* 载入系统参数 */
$_CFG = load_config();
/* 载入语言文件 */
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/common.php';
if ($_CFG['shop_closed'] == 1) {
    /* 商店关闭了,输出关闭的消息 */
    header('Content-type: text/html; charset=' . EC_CHARSET);
    die('<div style="margin: 150px; text-align: center; font-size: 14px"><p>' . $_LANG['shop_closed'] . '</p><p>' . $_CFG['close_comment'] . '</p></div>');
}
if (is_spider()) {
    /* 如果是蜘蛛的访问,那么默认为访客方式,并且不记录到日志中 */
Example #28
0
    if (!empty($_GET)) {
        $_GET = addslashes_deep($_GET);
    }
    if (!empty($_POST)) {
        $_POST = addslashes_deep($_POST);
    }
    $_COOKIE = addslashes_deep($_COOKIE);
    $_REQUEST = addslashes_deep($_REQUEST);
}
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', $ecs->data_dir());
define('IMAGE_DIR', $ecs->image_dir());
/* 初始化数据库类 */
require ROOT_PATH . 'includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db->set_disable_cache_tables(array($ecs->table('sessions'), $ecs->table('sessions_data'), $ecs->table('cart')));
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 创建错误处理对象 */
$err = new ecs_error('message.dwt');
/* 载入系统参数 */
$_CFG = load_config();
/* 载入语言文件 */
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/common.php';
if ($_CFG['shop_closed'] == 1) {
    /* 商店关闭了,输出关闭的消息 */
    header('Content-type: text/html; charset=' . EC_CHARSET);
    die('<div style="margin: 150px; text-align: center; font-size: 14px"><p>' . $_LANG['shop_closed'] . '</p><p>' . $_CFG['close_comment'] . '</p></div>');
}
if (is_spider()) {
    /* 如果是蜘蛛的访问,那么默认为访客方式,并且不记录到日志中 */
Example #29
0
    }
    $_COOKIE = addslashes_deep($_COOKIE);
    $_REQUEST = addslashes_deep($_REQUEST);
}
/* 对路径进行安全处理 */
if (strpos(PHP_SELF, '.php/') !== false) {
    ecs_header("Location:" . substr(PHP_SELF, 0, strpos(PHP_SELF, '.php/') + 4) . "\n");
    exit;
}
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', $ecs->data_dir());
define('IMAGE_DIR', $ecs->image_dir());
/* 初始化数据库类 */
require ROOT_PATH . 'includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 创建错误处理对象 */
$err = new ecs_error('message.htm');
/* 初始化session */
require ROOT_PATH . 'includes/cls_session.php';
$sess = new cls_session($db, $ecs->table('sessions'), $ecs->table('sessions_data'), 'ECSCP_ID');
/* 初始化 action */
if (!isset($_REQUEST['act'])) {
    $_REQUEST['act'] = '';
} elseif (($_REQUEST['act'] == 'login' || $_REQUEST['act'] == 'logout' || $_REQUEST['act'] == 'signin') && strpos(PHP_SELF, '/privilege.php') === false) {
    $_REQUEST['act'] = '';
} elseif (($_REQUEST['act'] == 'forget_pwd' || $_REQUEST['act'] == 'reset_pwd' || $_REQUEST['act'] == 'get_pwd') && strpos(PHP_SELF, '/get_password.php') === false) {
    $_REQUEST['act'] = '';
}
/* 载入系统参数 */
Example #30
0
        $result['content'] = $_LANG['check_complete'];
        $result['is_end'] = 1;
        /* 查找有无重名用户,无重名用户则直接同步,有则查看重名用户 */
        $sql = 'SELECT COUNT(*) FROM ' . $ecs->table('users') . ' WHERE flag > 0 ';
        if ($db->getOne($sql) > 0) {
            $result['href'] = 'integrate.php?act=modify';
        } else {
            $result['href'] = 'integrate.php?act=sync';
        }
    }
    die($json->encode($result));
}
if ($_REQUEST['act'] == 'import_user') {
    $cfg = $_SESSION['cfg'];
    include_once ROOT_PATH . 'includes/cls_json.php';
    $ucdb = new cls_mysql($cfg['db_host'], $cfg['db_user'], $cfg['db_pass'], $cfg['db_name'], $cfg['db_charset']);
    $json = new JSON();
    $result = array('error' => 0, 'message' => '');
    $query = $db->query("SHOW TABLE STATUS LIKE '" . $GLOBALS['prefix'] . 'users' . "'");
    $data = $db->fetch_array($query);
    if ($data['Auto_increment']) {
        $maxuid = $data['Auto_increment'] - 1;
    } else {
        $maxuid = 0;
    }
    $merge_method = intval($_POST['merge']);
    $merge_uid = array();
    $uc_uid = array();
    $repeat_user = array();
    $query = $db->query('SELECT * FROM ' . $ecs->table('users') . ' ORDER BY `user_id` ASC');
    while ($data = $db->fetch_array($query)) {