Ejemplo n.º 1
0
 public function __construct()
 {
     //调用其他数据库配置文件,操作其他数据库
     $this->db_config = System::load_sys_config('database');
     $this->db_setting = 'two';
     parent::__construct();
 }
Ejemplo n.º 2
0
 protected final function view($module = '', $template = '', $StyleTheme = '')
 {
     if (empty($StyleTheme)) {
         $style = G_STYLE . DIRECTORY_SEPARATOR . G_STYLE_HTML;
     } else {
         $templates = System::load_sys_config('templates', $style);
         $style = $templates['dir'] . DIRECTORY_SEPARATOR . $templates['html'];
     }
     $FileTpl = G_CACHES . 'caches_template' . DIRECTORY_SEPARATOR . dirname($style) . DIRECTORY_SEPARATOR . md5($module . '.' . $template) . '.tpl.php';
     $FileHtml = G_TEMPLATES . $style . DIRECTORY_SEPARATOR . $module . '.' . $template . '.html';
     if (file_exists($FileHtml)) {
         if (file_exists($FileTpl) && @filemtime($FileTpl) >= @filemtime($FileHtml)) {
             return include $FileTpl;
         } else {
             $template_cache = System::load_sys_class('template_cache');
             if (!is_dir(dirname(dirname($FileTpl)))) {
                 mkdir(dirname(dirname($FileTpl)), 0777, true) or die("Not Dir");
                 chmod(dirname(dirname($FileTpl)), 0777);
             }
             if (!is_dir(dirname($FileTpl))) {
                 mkdir(dirname($FileTpl), 0777, true) or die("Not Dir");
                 chmod(dirname($FileTpl), 0777);
             }
             $PutFileTpl = $template_cache->template_init($FileTpl, $FileHtml, $module, $template);
             if ($PutFileTpl) {
                 return include $FileTpl;
             } else {
                 _error('template message', 'The "' . $module . '.' . $template . '" template file does not exist');
             }
         }
     }
     _error('template message', 'The "' . $module . '.' . $template . '" template file does not exist');
 }
Ejemplo n.º 3
0
 public function init()
 {
     $mobile = System::load_sys_config("mobile");
     if (!isset($mobile['cfg_mobile_2']) || !isset($mobile['cfg_mobile_on'])) {
         $mobiles = array();
         $mobiles['cfg_mobile_1'] = $mobiles['cfg_mobile_2'] = array();
         $mobiles['cfg_mobile_2']['mid'] = $mobile['mid'];
         $mobiles['cfg_mobile_2']['mpass'] = $mobile['mpass'];
         $mobiles['cfg_mobile_2']['mqianming'] = $mobile['mqianming'];
         $mobiles['cfg_mobile_1']['mid'] = '';
         $mobiles['cfg_mobile_1']['mpass'] = '';
         $mobiles['cfg_mobile_on'] = 2;
         if (!is_writable(G_CONFIG . 'mobile.inc.php')) {
             _message('Please chmod  mobile.ini.php  to 0777 !');
         }
         $html = var_export($mobiles, true);
         $html = "<?php \n return " . $html . "; \n?>";
         $ok = file_put_contents(G_CONFIG . 'mobile.inc.php', $html);
         if ($ok) {
             _message("升级成功!");
         }
     } else {
         @unlink(__FILE__);
         _message("无需升级!");
     }
 }
Ejemplo n.º 4
0
 public function Tdefault()
 {
     $info = $this->AdminInfo;
     $SysInfo = GetSysInfo();
     $SysInfo['MysqlVersion'] = $this->db->GetVersion();
     $versions = System::load_sys_config("version");
     $banben_arr = explode(",", _encrypt(G_BANBEN_TYPE, "DECODE", "G_BANBEN_TYPE"));
     $banben_num = G_BANBEN_NUMBER;
     if (isset($banben_arr[$banben_num])) {
         $banben_txt = $banben_arr[$banben_num];
     } else {
         if (G_BANBEN_NUMBER == -1) {
             $banben_txt = base64_decode("5pyq5o6I5p2D");
         } else {
             if (G_BANBEN_NUMBER == -2) {
                 $banben_txt = base64_decode("5o6I5p2D5Yiw5pyf");
             } else {
                 $banben_txt = base64_decode("5pyq5o6I5p2D");
             }
         }
     }
     $yungou_alert = file_get_contents("http://www.baidu.com");
     $text = $banben_txt;
     //$catelen = $this->db->count();
     include $this->tpl(ROUTE_M, 'admin.default');
 }
Ejemplo n.º 5
0
 public function send_shop_code()
 {
     if (!isset($_POST['send']) && !isset($_POST['uid']) && !isset($_POST['gid'])) {
         exit(0);
     }
     $uid = abs($_POST['uid']);
     $gid = abs($_POST['gid']);
     $db = System::load_sys_class("model");
     $sendinfo = $db->GetOne("SELECT id,send_type FROM `@#_send` WHERE `gid` = '{$gid}' and `uid` = '{$uid}'");
     if ($sendinfo) {
         exit(0);
     }
     $member = $db->GetOne("SELECT * FROM `@#_member` WHERE `uid` = '{$uid}'");
     if (!$member) {
         exit(0);
     }
     $info = $db->GetOne("SELECT id,q_user_code,q_end_time,title,q_user FROM `@#_shoplist` WHERE `id` = '{$gid}' and `q_uid` = '{$uid}'");
     if (!$info) {
         exit(0);
     }
     $username = get_user_name($member, 'username', 'all');
     $this->send_insert($uid, $gid, $username, $info['title'], '-1');
     $type = System::load_sys_config("send", "type");
     if (!$type) {
         exit(0);
     }
     $q_time = abs(substr($info['q_end_time'], 0, 10));
     while (time() < $q_time) {
         sleep(5);
     }
     $ret_send = false;
     if ($type == '1') {
         if (!empty($member['email'])) {
             send_email_code($member['email'], $username, $uid, $info['q_user_code'], $info['title']);
             $ret_send = true;
         }
     }
     if ($type == '2') {
         if (!empty($member['mobile'])) {
             send_mobile_shop_code($member['mobile'], $uid, $info['q_user_code']);
             $ret_send = true;
         }
     }
     if ($type == '3') {
         if (!empty($member['email'])) {
             send_email_code($member['email'], $username, $uid, $info['q_user_code'], $info['title']);
             $ret_send = true;
         }
         if (!empty($member['mobile'])) {
             send_mobile_shop_code($member['mobile'], $uid, $info['q_user_code']);
             $ret_send = true;
         }
     }
     if ($ret_send) {
         $this->send_insert($uid, $gid, $username, $info['title'], $type);
     }
     exit(0);
 }
Ejemplo n.º 6
0
function pay_insert_shop($shop = '', $type = '')
{
    $time = sprintf("%.3f", microtime(true) + (int) System::load_sys_config('system', 'goods_end_time'));
    $db = System::load_sys_class("model");
    if ($shop['xsjx_time'] != '0') {
        return $db->Query("UPDATE `@#_shoplist` SET `canyurenshu`=`zongrenshu`,\t`shenyurenshu` = '0' where `id` = '{$shop['id']}'");
    }
    $tocode = System::load_app_class("tocode", "pay");
    $tocode->shop = $shop;
    $tocode->run_tocode($time, 100, $shop['canyurenshu'], $shop);
    $code = $tocode->go_code;
    $content = $tocode->go_content;
    $counttime = $tocode->count_time;
    $u_go_info = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}' and `goucode` LIKE  '%{$code}%'");
    $u_info = $db->GetOne("select * from `@#_member` where `uid` = '{$u_go_info['uid']}'");
    $q_user = serialize($u_info);
    //更新商品
    $query = true;
    if ($u_info) {
        $gtimes = (int) System::load_sys_config('system', 'goods_end_time');
        if ($gtimes == 0 || $gtimes == 1) {
            $q_showtime = 'N';
        } else {
            $q_showtime = 'Y';
        }
        $q = $db->Query("UPDATE `@#_shoplist` SET \n\t\t\t\t\t\t\t`canyurenshu`=`zongrenshu`,\n\t\t\t\t\t\t\t`shenyurenshu` = '0',\n\t\t\t\t\t\t\t`q_uid` = '{$u_info['uid']}',\n\t\t\t\t\t\t\t`q_user` = '{$q_user}',\n\t\t\t\t\t\t\t`q_user_code` = '{$code}',\n\t\t\t\t\t\t\t`q_content`\t= '{$content}',\n\t\t\t\t\t\t\t`q_counttime` ='{$counttime}',\n\t\t\t\t\t\t\t`q_end_time` = '{$time}',\n\t\t\t\t\t\t\t`q_showtime` = '{$q_showtime}'\n\t\t\t\t\t\t\t where `id` = '{$shop['id']}'");
        if (!$q) {
            $query = false;
        }
        $q = $db->Query("UPDATE `@#_member_go_record` SET `huode` = '{$code}' where `id` = '{$u_go_info['id']}' and `code` = '{$u_go_info['code']}' and `uid` = '{$u_go_info['uid']}' and `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}'");
        if (!$q) {
            $query = false;
        }
        $post_arr = array("uid" => $u_info['uid'], "gid" => $shop['id'], "send" => 1);
        _g_triggerRequest(WEB_PATH . '/api/send/send_shop_code', false, $post_arr);
    }
    /******************************/
    //新建
    if ($shop['qishu'] < $shop['maxqishu']) {
        $time = time();
        System::load_app_fun("content", G_ADMIN_DIR);
        $goods = $shop;
        $qishu = $goods['qishu'] + 1;
        $shenyurenshu = $goods['zongrenshu'] - $goods['def_renshu'];
        $query_table = content_get_codes_table();
        $q = $db->Query("INSERT INTO `@#_shoplist` (`sid`,`cateid`, `brandid`, `title`, `title_style`, `title2`, `keywords`, `description`, `money`, `yunjiage`, `zongrenshu`, `canyurenshu`,`shenyurenshu`,`def_renshu`, `qishu`,`maxqishu`,`thumb`, `picarr`, `content`,`codes_table`,`xsjx_time`,`renqi`,`pos`, `time`)\n\t\t\t\tVALUES\n\t\t\t\t('{$goods['sid']}','{$goods['cateid']}','{$goods['brandid']}','{$goods['title']}','{$goods['title_style']}','{$goods['title2']}','{$goods['keywords']}','{$goods['description']}','{$goods['money']}','{$goods['yunjiage']}','{$goods['zongrenshu']}','{$goods['def_renshu']}','{$shenyurenshu}','{$goods['def_renshu']}','{$qishu}','{$goods['maxqishu']}','{$goods['thumb']}','{$goods['picarr']}','{$goods['content']}','{$query_table}','{$goods['xsjx_time']}','{$goods['renqi']}','{$goods['pos']}','{$time}')\n\t\t\t\t");
        if (!$q) {
            return $query;
        }
        $id = $db->insert_id();
        $q = content_get_go_codes($goods['zongrenshu'], 3000, $id);
        if (!$q) {
            return $query;
        }
    }
    return $query;
}
Ejemplo n.º 7
0
 private function global_start()
 {
     if (!System::load_sys_config('system', 'web_off')) {
         $admin_dir = System::load_sys_config('system', 'admindir');
         if ($admin_dir !== ROUTE_M) {
             echo htmlspecialchars_decode(System::load_sys_config('system', 'web_off_text'));
             exit;
         }
     }
 }
Ejemplo n.º 8
0
 public function __construct()
 {
     $this->route_config = System::load_sys_config('param');
     $this->domain = System::load_sys_config('domain');
     $this->expstr = System::load_sys_config('system', 'expstr');
     $this->prourl();
     $this->sub_addslashes();
     System::load_sys_class('SystemAction', 'sys', 'no');
     SystemAction::set_route_url($this->route_url);
     global $_cfg;
     $_cfg['param_arr'] = $this->route_url;
     $_cfg['param_arr']['url'] = $this->param_url;
 }
Ejemplo n.º 9
0
 public function __construct()
 {
     if (empty($this->db_config)) {
         $this->db_config = System::load_sys_config('database');
     }
     if (!isset($this->db_config[$this->db_setting])) {
         $this->db_setting = 'default';
     }
     self::$strtablepre = System::load_sys_config('system', 'tablepre');
     self::$strtablepre = base64_decode(self::$strtablepre);
     self::$db_tablepre = $this->db_config[$this->db_setting]['tablepre'];
     $this->table_name = $this->db_config[$this->db_setting]['database'];
     $this->db = mysql::GetObject($this->db_config[$this->db_setting]);
 }
Ejemplo n.º 10
0
 public function init()
 {
     $db = System::load_sys_class("model");
     $version = System::load_sys_config('version');
     $v_time = $version['release'];
     $v_version = $version['version'];
     $ret = $db->GetOne("Describe `@#_shaidan_hueifu` sdhf_username");
     if (!$ret) {
         return;
     }
     $hflist = $db->GetList("select * from `@#_shaidan_hueifu` where `sdhf_img` is null or `sdhf_img` = ''");
     foreach ($hflist as $key => $val) {
         $user = $db->GetOne("select uid,username,email,mobile,img from `@#_member` where `uid` = '{$val['sdhf_userid']}'");
         $username = get_user_name($user);
         $db->Query("UPDATE `@#_shaidan_hueifu` SET `sdhf_img` = '{$user['img']}',`sdhf_username` = '{$username}' where `id` = '{$val['id']}'");
     }
     unlink(__FILE__);
     _message("数据库升级成功", G_WEB_PATH);
 }
Ejemplo n.º 11
0
 public function __construct()
 {
     if (empty($this->db_config)) {
         $this->db_config = System::load_sys_config('database');
     }
     if (!isset($this->db_config[$this->db_setting])) {
         $this->db_setting = 'default';
     }
     $DBTYPE = $this->db_config[$this->db_setting]['type'];
     System::load_sys_class($DBTYPE, 'sys', 'no');
     self::$strtablepre = System::load_sys_config('system', 'tablepre');
     self::$strtablepre = base64_decode(self::$strtablepre);
     self::$db_tablepre = $this->db_config[$this->db_setting]['tablepre'];
     $this->table_name = $this->db_config[$this->db_setting]['database'];
     //PHP5.2
     $this->db = call_user_func_array("{$DBTYPE}::GetObject", array($this->db_config[$this->db_setting]));
     //PHP5.3
     //$this->db = $DBTYPE::GetObject($this->db_config[$this->db_setting]);
 }
Ejemplo n.º 12
0
 public function get_cityqq()
 {
     $prov = urldecode(trim($this->segment(4)));
     $cityv = urldecode(trim($this->segment(5)));
     $couv = urldecode(trim($this->segment(6)));
     $prov = safe_replace($prov);
     $cityv = safe_replace($cityv);
     $couv = safe_replace($couv);
     if (!_is_utf8($prov)) {
         $prov = iconv("GBK", "UTF-8", $prov);
     }
     if (!_is_utf8($cityv)) {
         $cityv = iconv("GBK", "UTF-8", $cityv);
     }
     if (!_is_utf8($couv)) {
         $couv = iconv("GBK", "UTF-8", $couv);
     }
     $str = '----请选择----';
     if ($prov != $str && $cityv == $str && $couv == $str) {
         $res = $this->db->GetList("SELECT * FROM `@#_qqset` where `province`='{$prov}'");
     }
     if ($prov != $str && $cityv != $str && $couv == $str) {
         $res = $this->db->GetList("SELECT * FROM `@#_qqset` where `province`='{$prov}' and `city`='{$cityv}'");
     }
     if ($prov != $str && $cityv != $str && $couv != $str) {
         $res = $this->db->GetList("SELECT * FROM `@#_qqset` where `province`='{$prov}' and `city`='{$cityv}' and `county`='{$couv}'");
     }
     if (!empty($res)) {
         $str = '<ul>';
         foreach ($res as $v) {
             $str .= '<li><dt><img border="0" alt="' . $v['name'] . '" src="' . G_TEMPLATES_IMAGE . '/logo.jpg"></dt><dt>' . $v['name'];
             if ($v['full'] == '已满') {
                 $str .= '<img src="' . G_TEMPLATES_IMAGE . '/qqhot.gif"/>';
             }
             $str .= '</dt><dd><a href="' . $v['qqurl'] . '">' . $v['qq'] . '</a></dd></li>';
         }
         $str .= '</ul>';
     } else {
         $email = System::load_sys_config('email', 'user');
         $str = "<div class='nothing'>该地区暂无QQ群加盟," . _cfg("web_name_two") . "诚邀您加盟,详情请咨询Email:<a href='mailto:" . $email . "' target='_blank' >" . $email . "</div>";
     }
     echo $str;
 }
Ejemplo n.º 13
0
 public function register()
 {
     $config_email = System::load_sys_config("email");
     $config_mobile = System::load_sys_config("mobile");
     if (isset($_POST['submit'])) {
         $name = isset($_POST['name']) ? $_POST['name'] : "";
         $userpassword = isset($_POST['userpassword']) ? $_POST['userpassword'] : "";
         $userpassword2 = isset($_POST['userpassword2']) ? $_POST['userpassword2'] : "";
         if ($name == null or $userpassword == null or $userpassword2 == null) {
             _message("帐号密码不能为空", null, 3);
         }
         if (!(_checkmobile($name) or _checkemail($name))) {
             _message("帐号不是手机或邮箱", null, 3);
         }
         if (strlen($userpassword) < 6 || strlen($userpassword) > 20) {
             _message("密码小于6位或大于20位", null, 3);
         }
         if ($userpassword != $userpassword2) {
             _message("两次密码不一致", null, 3);
         }
         $regtype = null;
         if (_checkmobile($name)) {
             $regtype = 'mobile';
             $cfg_mobile_type = 'cfg_mobile_' . $config_mobile['cfg_mobile_on'];
             $config_mobile = $config_mobile[$cfg_mobile_type];
             if (empty($config_mobile['mid']) && empty($config_email['mpass'])) {
                 _message("系统短信配置不正确!");
             }
         }
         if (_checkemail($name)) {
             $regtype = 'email';
             if (empty($config_email['user']) && empty($config_email['pass'])) {
                 _message("系统邮箱配置不正确!");
             }
         }
         if ($regtype == null) {
             _message("注册类型不正确!", null, 3);
         }
         $member = $this->db->GetOne("SELECT * FROM `@#_member` WHERE `{$regtype}` = '{$name}' or `reg_key` = '{$name}' LIMIT 1");
         if (is_array($member)) {
             _message("该账号已被注册!", WEB_PATH . '/register');
         }
         $time = time();
         $userpassword = md5($userpassword);
         $codetype = $regtype . 'code';
         $decode = _encrypt($this->segment(4), "DECODE");
         $decode = intval($decode);
         //邮箱验证 -1 代表未验证, 1 验证成功 都不等代表等待验证
         $sql = "INSERT INTO `@#_member`(password,img,emailcode,mobilecode,reg_key,yaoqing,time)VALUES('{$userpassword}','photo/member.jpg','-1','-1','{$name}','{$decode}','{$time}')";
         if ($this->db->Query($sql)) {
             $check_code = serialize(array("name" => $name, "time" => $time));
             $check_code = _encrypt($check_code, "ENCODE", '', 3600 * 24);
             header("location:" . WEB_PATH . "/member/user/" . $regtype . "check" . "/" . $check_code);
             exit;
         } else {
             _message("注册失败!", WEB_PATH . '/register');
         }
     }
     $title = "注册" . _cfg("web_name");
     include templates("user", "register");
 }
Ejemplo n.º 14
0
 public function checkname()
 {
     $config_email = System::load_sys_config("email");
     $config_mobile = System::load_sys_config("mobile");
     $user = array();
     $name = $this->segment(4);
     $regtype = null;
     if (_checkmobile($name)) {
         $regtype = 'mobile';
         $cfg_mobile_type = 'cfg_mobile_' . $config_mobile['cfg_mobile_on'];
         $config_mobile = $config_mobile[$cfg_mobile_type];
         if (empty($config_mobile['mid']) && empty($config_email['mpass'])) {
             $user['state'] = 2;
             //_message("系统短息配置不正确!");
             echo json_encode($user);
             exit;
         }
     }
     $member = $this->db->GetOne("SELECT * FROM `@#_member` WHERE `mobile` = '{$name}' LIMIT 1");
     if (is_array($member)) {
         if ($member['mobilecode'] == 1 || $member['emailcode'] == 1) {
             $user['state'] = 1;
             //_message("该账号已被注册");
         } else {
             $sql = "DELETE from`@#_member` WHERE `mobile` = '{$name}'";
             $this->db->Query($sql);
             $user['state'] = 0;
         }
     } else {
         $user['state'] = 0;
         //表示数据库里没有该帐号
     }
     echo json_encode($user);
 }
Ejemplo n.º 15
0
 public function lottery_shop_set()
 {
     if (isset($_POST['lottery_sub'])) {
         $db = System::load_sys_class('model');
         $times = (int) System::load_sys_config('system', 'goods_end_time');
         $gid = isset($_POST['gid']) ? abs(intval($_POST['gid'])) : exit;
         $info = $db->GetOne("select id,xsjx_time,thumb,title,q_uid,q_user,q_end_time from `@#_shoplist` where `id` ='{$gid}'");
         if (!$info || empty($info['q_end_time'])) {
             echo '0';
             exit;
         }
         if ($info['xsjx_time']) {
             $info['q_end_time'] = $info['q_end_time'] + $times;
         }
         $times = str_ireplace(".", "", $info['q_end_time']);
         $q_time = substr($info['q_end_time'], 0, 10);
         $q = false;
         if (time() >= $q_time) {
             $q = $db->Query("update `@#_shoplist` SET `q_showtime` = 'N' where `id` = '{$gid}' and `q_showtime` = 'Y' and `q_uid` is not null");
         }
         if ($q) {
             echo '1';
         } else {
             echo '0';
         }
     }
 }
Ejemplo n.º 16
0
 *
 * @var string
 *
 */
define('WC_VERSION', System::load_sys_config("version", 'version'));
if (!is_php('5.3')) {
    @set_magic_quotes_runtime(0);
}
define('G_BANBEN_NUMBER', 3);
/*
 * ------------------------------------------------------
 *  Set a liberal script execution time limit
 * ------------------------------------------------------
 */
if (function_exists("set_time_limit") == TRUE and @ini_get("safe_mode") == 0) {
    @set_time_limit(100);
}
/*
 *---------------------------------------------------------------
 *	CHARSET set
 *---------------------------------------------------------------
 *
 */
define('G_CHARSET', System::load_sys_config('system', 'charset'));
header('Content-type: text/html; charset=' . G_CHARSET);
unset($templates);
if (System::load_sys_config('system', 'gzip') && function_exists('ob_gzhandler')) {
    ob_start('ob_gzhandler');
} else {
    ob_start();
}
Ejemplo n.º 17
0
 public static function watermark($bgimg = null, $type = null, $content = null, $minsize = null, $pos = null)
 {
     $bgimg = !empty($bgimg) ? $bgimg : self::$uploadpath . self::$filename;
     $type = !empty($type) ? $type : System::load_sys_config('upload', 'watermark_type');
     $minsize = !empty($minsize) ? $minsize : System::load_sys_config('upload', 'watermark_condition');
     $pos = !empty($pos) ? $pos : System::load_sys_config('upload', 'watermark_position');
     if (file_exists(!$bgimg)) {
         return false;
     }
     //获得背景图片
     $bgimg_info = getimagesize($bgimg);
     list($bg_width, $bg_height) = $bgimg_info;
     switch ($bgimg_info[2]) {
         case 1:
             $from_bgimg = imagecreatefromgif($bgimg);
             break;
         case 2:
             $from_bgimg = imagecreatefromjpeg($bgimg);
             break;
         case 3:
             $from_bgimg = imagecreatefrompng($bgimg);
             break;
         case 4:
             $from_bgimg = self::ImageCreateFromBMP($bgimg);
             //imagecreatefromwbmp
             break;
         default:
             break;
     }
     if ($bg_width < $minsize['width'] || $bg_height < $minsize['height']) {
         //背景图尺寸不够
         return false;
     }
     //设定图像的混色模式
     imagealphablending($from_bgimg, true);
     //文字水印
     if ($type == 'text') {
         if (!is_array($content)) {
             $content = System::load_sys_config('upload', 'watermark_text');
         }
         $temp = imagettfbbox($content['size'], 0, $content['font'], $content['text']);
         //取得使用 TrueType 字体的文本的范围
         $markwidth = $temp[2] - $temp[6];
         $markheight = $temp[3] - $temp[7];
         unset($temp);
         //释放内存
         switch ($pos) {
             case 'lt':
                 //左上
                 $pos_x = 10;
                 $pos_y = $markheight;
                 break;
             case 't':
                 //上
                 $pos_x = ($bg_width - $markwidth) / 2;
                 $pos_y = $markheight;
                 break;
             case 'rt':
                 //右上
                 $pos_x = $bg_width - $markwidth - 10;
                 $pos_y = $markheight;
                 break;
             case 'r':
                 //右
                 $pos_x = $bg_width - $markwidth - 10;
                 $pos_y = ($bg_height + $markheight / 2) / 2;
                 break;
             case 'rb':
                 //右下
                 $pos_x = $bg_width - $markwidth - 10;
                 $pos_y = $bg_height - 10;
                 break;
             case 'b':
                 //下
                 $pos_x = ($bg_width - $markwidth) / 2;
                 $pos_y = $bg_height - 10;
                 break;
             case 'lb':
                 //左下
                 $pos_x = 10;
                 $pos_y = $bg_height - $markheight - 10;
                 break;
             case 'l':
                 //左
                 $pos_x = 10;
                 $pos_y = ($bg_height + $markheight / 2) / 2;
                 break;
             case 'c':
                 //中
                 $pos_x = ($bg_width - $markwidth) / 2;
                 $pos_y = ($bg_height + $markheight / 2) / 2;
                 break;
             case 's':
                 //随机
                 $pos_x = rand(0, $bg_width - $markwidth - 10);
                 $pos_y = rand($markheight, $bg_height - 10);
                 break;
             default:
                 //默认随机
                 $pos_x = rand(0, $bg_width - $markwidth - 10);
                 $pos_y = rand($markheight, $bg_height - 10);
                 break;
         }
         //转换编码防止中文乱码
         //$content['text'] = mb_convert_encoding($content['text'], 'UTF-8', 'GB2312');
         //获取水印文字颜色
         if (!empty($content['color']) && strlen($content['color']) == 7) {
             $R = hexdec(substr($content['color'], 1, 2));
             $G = hexdec(substr($content['color'], 3, 2));
             $B = hexdec(substr($content['color'], 5));
         } else {
             if (!empty($content['color']) && strlen($content['color']) == 3) {
                 $R = hexdec(substr($content['color'], 1, 1));
                 $G = hexdec(substr($content['color'], 2, 2));
                 $B = hexdec(substr($content['color'], 3, 3));
             } else {
                 $R = '00';
                 $G = '00';
                 $B = '00';
             }
         }
         //把生成的文字区域写入到图片文件里
         $color_qg = imagecolorallocate($from_bgimg, $R, $G, $B);
         imagettftext($from_bgimg, $content['size'], 0, $pos_x, $pos_y, $color_qg, $content['font'], $content['text']);
     }
     if ($type == 'image') {
         if (empty($content)) {
             $content = G_UPLOAD . System::load_sys_config('upload', 'watermark_image');
         }
         $markimg_info = getimagesize($content);
         list($markwidth, $markheight) = $markimg_info;
         switch ($markimg_info[2]) {
             case 1:
                 $from_markimg = imagecreatefromgif($content);
                 break;
             case 2:
                 $from_markimg = imagecreatefromjpeg($content);
                 break;
             case 3:
                 $from_markimg = imagecreatefrompng($content);
                 break;
             case 4:
                 $from_markimg = self::ImageCreateFromBMP($content);
                 //imagecreatefromwbmp
                 break;
             default:
                 break;
         }
         switch ($pos) {
             case 'lt':
                 //左上
                 $pos_x = 0;
                 $pos_y = 0;
                 break;
             case 't':
                 //上
                 $pos_x = ($bg_width - $markwidth) / 2;
                 $pos_y = 0;
                 break;
             case 'rt':
                 //右上
                 $pos_x = $bg_width - $markwidth;
                 $pos_y = 0;
                 break;
             case 'r':
                 //右
                 $pos_x = $bg_width - $markwidth;
                 $pos_y = ($bg_height - $markheight) / 2;
                 break;
             case 'rb':
                 //右下
                 $pos_x = $bg_width - $markwidth;
                 $pos_y = $bg_height - $markheight;
                 break;
             case 'b':
                 //下
                 $pos_x = ($bg_width - $markwidth) / 2;
                 $pos_y = $bg_height - $markheight;
                 break;
             case 'lb':
                 //左下
                 $pos_x = 0;
                 $pos_y = $bg_height - $markheight;
                 break;
             case 'l':
                 //左
                 $pos_x = 0;
                 $pos_y = ($bg_height - $markheight) / 2;
                 break;
             case 'c':
                 //中
                 $pos_x = ($bg_width - $markwidth) / 2;
                 $pos_y = ($bg_height - $markheight) / 2;
                 break;
             case 's':
                 //随机
                 $pos_x = rand(0, $bg_width - $markwidth);
                 $pos_y = rand(0, $bg_height - $markheight);
                 break;
             default:
                 //默认随机
                 $pos_x = rand(0, $bg_width - $markwidth);
                 $pos_y = rand(0, $bg_height - $markheight);
                 break;
         }
         //imagecopymerge可以设置透明度,但是不支持透明图片
         imagecopy($from_bgimg, $from_markimg, $pos_x, $pos_y, 0, 0, $markwidth, $markheight);
         //拷贝水印到目标文件
     }
     //取得背景图片的格式
     switch ($bgimg_info[2]) {
         case 1:
             //header('Content-type: image/gif');
             imagegif($from_bgimg, $bgimg);
             //第三个参数为生成带水印的图像质量 100 为最高
             break;
         case 2:
             //header('Content-type: image/jpeg');
             imagejpeg($from_bgimg, $bgimg, 100);
             break;
         case 3:
             //header('Content-type: image/png');
             imagepng($from_bgimg, $bgimg);
             break;
         case 4:
             //header('Content-type: image/vnd.wap.wbmp');
             imagewbmp($from_bgimg, $bgimg);
             break;
         default:
             break;
     }
     imagedestroy($from_bgimg);
     return $bgimg;
 }
Ejemplo n.º 18
0
function encourage_num()
{
    $e_id = System::load_sys_config("encourage");
    if ($e_id['e_start'] == 'Y') {
        return $e_id;
    }
}
 public function sendsuccess()
 {
     if (!isset($_POST['submit'])) {
         _message("参数错误", WEB_PATH . '/member/home/modify');
     }
     if (!isset($_POST['email']) || empty($_POST['email'])) {
         _message("邮箱地址不能为空!", WEB_PATH . '/member/home/modify');
     }
     if (!_checkemail($_POST['email'])) {
         _message("邮箱格式错误!", WEB_PATH . '/member/home/modify');
     }
     $config_email = System::load_sys_config("email");
     if (empty($config_email['user']) && empty($config_email['pass'])) {
         _message("系统邮箱配置不正确!", WEB_PATH . '/member/home/modify');
     }
     $member = $this->userinfo;
     $title = "发送成功";
     $email = $_POST['email'];
     $member2 = $this->db->GetOne("select * from `@#_member` where `email`='{$email}' and `uid` != '{$member['uid']}'");
     if (!empty($member2) && $member2['emailcode'] == 1) {
         _message("该邮箱已经存在,请选择另外的邮箱验证!", WEB_PATH . '/member/home/modify');
     }
     $strcode1 = $email . "," . $member['uid'] . "," . time();
     $strcode = _encrypt($strcode1);
     $tit = $this->_cfg['web_name_two'] . "激活注册邮箱";
     $content = '<span>请在24小时内绑定邮箱</span>,点击链接:<a href="' . WEB_PATH . '/member/home/emailcheckingok/' . $strcode . '">';
     $content .= WEB_PATH . '/member/home/emailcheckingok/' . $strcode . '</a>';
     $succ = _sendemail($email, '', $tit, $content, 'yes', 'no');
     if ($succ == 'no') {
         _message("邮件发送失败!", WEB_PATH . '/member/home/modify', 30);
     } else {
         include templates("member", "sendsuccess");
     }
 }
Ejemplo n.º 20
0
 public function web()
 {
     $upfile_url = $this->uppath;
     $version = System::load_sys_config('version', 'release');
     //获取压缩包
     $content = @file_get_contents($upfile_url);
     if (!$content) {
         _message("升级失败,获取压缩包列表失败");
     }
     //数组的位置
     $key = -1;
     $allpathlist = $pathlist = array();
     preg_match_all("/>(patch_[\\w_]+\\.zip)</", $content, $allpathlist);
     $allpathlist = $allpathlist[1];
     //获取可供当前版本升级的压缩包
     foreach ($allpathlist as $k => $v) {
         if (strstr($v, 'patch_' . $version)) {
             $key = $k;
             break;
         }
     }
     $key = $key < 0 ? 9999 : $key;
     foreach ($allpathlist as $k => $v) {
         if ($k >= $key) {
             $pathlist[$k] = $v;
         }
     }
     //开始升级
     //检查服务器是否支持zip
     if (empty($pathlist)) {
         _message("没有可升级文件");
     }
     //创建缓存文件夹
     if (!file_exists(G_CACHES . 'caches_upfile')) {
         @mkdir(G_CACHES . 'caches_upfile');
     }
     //根据版本下载zip升级包,解压覆盖
     System::load_app_class('pclzip', 'api', 'no');
     foreach ($pathlist as $k => $v) {
         //远程压缩包地址
         $zip_url = $upfile_url . $v;
         //保存到本地地址
         $zip_path = G_CACHES . 'caches_upfile' . DIRECTORY_SEPARATOR . $v;
         //解压路径
         $zip_source_path = G_CACHES . 'caches_upfile' . DIRECTORY_SEPARATOR . basename($v, ".zip");
         //下载压缩包
         @file_put_contents($zip_path, @file_get_contents($zip_url));
         //解压缩
         $archive = new PclZip($zip_path);
         if ($archive->extract(PCLZIP_OPT_PATH, $zip_source_path, PCLZIP_OPT_REPLACE_NEWER) == 0) {
             die("Error : " . $archive->errorInfo(true));
         }
         //拷贝文件夹到根目录
         $copy_from = $zip_source_path . DIRECTORY_SEPARATOR;
         $copy_to = G_APP_PATH;
         $this->copyfailnum = 0;
         $this->copydir($copy_from, $copy_to, 'cover');
         //检查文件操作权限,是否复制成功
         if ($this->copyfailnum > 0) {
             //如果失败,恢复当前版本
             _message("升级失败");
         }
         /***************** 执行 SQL START  ***************/
         $sql_path = G_CACHES . 'caches_upfile' . DIRECTORY_SEPARATOR . basename($v, ".zip") . DIRECTORY_SEPARATOR . 'up.sql';
         if (file_exists($sql_path)) {
             $mysql_server_version = $this->db->GetVersion(true);
             $dbcharset = System::load_sys_config('database', 'default');
             $dbcharset = $dbcharset['charset'];
             $data = file_get_contents($sql_path);
             $sqls = explode(';', $data);
             if (strlen(end($sqls)) == 2) {
                 array_pop($sqls);
             }
             if (count($sqls) >= 1) {
                 foreach ($sqls as $sql) {
                     //if (empty($sql)) continue;
                     if ($mysql_server_version > '4.1' && $dbcharset) {
                         $sql = preg_replace("/TYPE=(InnoDB|MyISAM|MEMORY)( DEFAULT CHARSET=[^; ]+)?/", "TYPE=\\1 DEFAULT CHARSET=" . $dbcharset, $sql);
                     }
                     if (!empty($sql) && strlen($sql) != 2) {
                         $this->db->Query($sql);
                     }
                 }
             }
         }
         /***************** 执行 SQL END ******************/
         if (file_exists($sql_path)) {
             $sql_path = G_APP_PATH . 'up.sql';
             @unlink($sql_path);
         }
         $sever_upfile = G_CACHES . 'caches_upfile' . DIRECTORY_SEPARATOR . basename($v, ".zip") . DIRECTORY_SEPARATOR . 'sever_upfile.php';
         if (file_exists($sever_upfile)) {
             $sever_upfile = G_APP_PATH . 'sever_upfile.php';
             include $sever_upfile;
             @unlink($sever_upfile);
         }
         //删除文件
         @unlink($zip_path);
         //删除文件夹
         $this->deletedir($zip_source_path);
         //升级成功"
     }
     _message("升级成功", G_MODULE_PATH . "/upfile/init");
 }
Ejemplo n.º 21
0
function _cfg($name = '')
{
    return System::load_sys_config('system', $name);
}
Ejemplo n.º 22
0
 private function mobile_con_check($content = null)
 {
     $this->mobile = $mobile = System::load_sys_config('mobile');
     $mobile = $this->mobile['cfg_mobile_1'];
     $name = urlencode($mobile['mid']);
     $pwd = $mobile['mpass'];
     $content = iconv("UTF-8", "gb2312//IGNORE", $content);
     $content = urlencode($content);
     $con_check = fopen("http://www.139000.com/send/checkcontent.asp?name={$name}&pwd={$pwd}&content={$content}", "r");
     if (!$con_check) {
         fclose($con_check);
     }
     $rets = '';
     while (!feof($con_check)) {
         $rets .= fgets($con_check, 1024);
     }
     if ($rets) {
         $rets = $this->exp_url($rets);
         if ($rets['errid'] == '0') {
             return array("1", "新短信接口内容合法");
         } else {
             return array("-1", "内容检测失败,不能包含:【" . $rets['err'] . '】');
         }
     } else {
         return array("-1", "检测失败");
     }
 }
Ejemplo n.º 23
0
 private function qq_set_member($uid = null, $type = 'bind_add_login')
 {
     $member_db = System::load_app_class('base', 'member');
     $memberone = $member_db->get_user_info();
     if ($memberone) {
         _message("该QQ号已经被其他用户所绑定!", WEB_PATH . '/login');
     }
     $member = $this->db->GetOne("select uid,password,mobile,email from `@#_member` where `uid` = '{$uid}' LIMIT 1");
     $_COOKIE['uid'] = null;
     $_COOKIE['ushell'] = null;
     $_COOKIE['UID'] = null;
     $_COOKIE['USHELL'] = null;
     $time = time();
     $user_ip = _get_ip_dizhi();
     $this->db->GetOne("UPDATE `@#_member` SET `user_ip` = '{$user_ip}',`login_time` = '{$time}' where `uid` = '{$uid}'");
     $s1 = _setcookie("uid", _encrypt($member['uid']), 60 * 60 * 24 * 7);
     $s2 = _setcookie("ushell", _encrypt(md5($member['uid'] . $member['password'] . $member['mobile'] . $member['email'])), 60 * 60 * 24 * 7);
     $domain = System::load_sys_config('domain');
     if (isset($domain[$_SERVER['HTTP_HOST']])) {
         if ($domain[$_SERVER['HTTP_HOST']]['m'] == 'mobile') {
             $callback_url = WEB_PATH . "/mobile/home";
         } else {
             $callback_url = WEB_PATH . "/member/home";
         }
     } else {
         $callback_url = WEB_PATH . "/member/home";
     }
     if ($s1 && $s2) {
         if (!$member['email'] || !$member['mobile']) {
             _message("登录成功,请绑定邮箱或手机号和及时修改默认密码!", $callback_url);
         }
         _message("登录成功!", $callback_url);
     } else {
         _message("登录失败请检查cookie!", G_WEB_PATH);
     }
 }
Ejemplo n.º 24
0
function pay_insert_shop($shop = '', $type = '')
{
    $time = sprintf("%.3f", microtime(true) + (int) System::load_sys_config('system', 'goods_end_time'));
    $db = System::load_sys_class("model");
    if ($shop['xsjx_time'] != '0') {
        return $db->Query("UPDATE `@#_shoplist` SET `canyurenshu`=`zongrenshu`,\t`shenyurenshu` = '0' where `id` = '{$shop['id']}'");
    }
    $apidata = file_get_contents("http://api.caipiaokong.com/lottery/?name=xjssc&format=json&uid=195161&num=1&token=3a914fc3d237dd40f6ad71b57ef5ac61793af9d4&order=sort");
    $apiarray = json_decode($apidata, true);
    foreach ($apiarray as $key => $value) {
        $apinumberstr = str_replace(",", "", $apiarray[$key]['number']);
    }
    $apinumber = intval($apinumberstr);
    $tocode = System::load_app_class("tocode", "pay");
    $tocode->shop = $shop;
    $tocode->run_tocode($time, 50, $shop['canyurenshu'], $apinumber, $shop);
    $code = $tocode->go_code;
    $content = addslashes($tocode->go_content);
    $counttime = $tocode->count_time;
    //20140901新增,判断是否指定中奖//
    if ($shop['quyu_begin'] && $shop['quyu_end']) {
        $ex_info = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}' and `uid` >'{$shop['quyu_begin']}' and `uid` <'{$shop['quyu_end']}' order by rand() limit 1");
        if ($ex_info['goucode']) {
            $ex_code = explode(",", $ex_info['goucode']);
            $ex_count = count($ex_code);
            $ex_rand = rand(0, $ex_count - 1);
            if (!empty($ex_code[$ex_rand])) {
                $chazhi = $ex_code[$ex_rand] - $code;
                if ($chazhi > 0) {
                    $counttime = $counttime + $chazhi;
                } else {
                    $counttime = $counttime - abs($chazhi);
                }
                $code = $ex_code[$ex_rand];
                /*
                $tempinfo = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '$shop[id]' and `shopqishu` = '$shop[qishu]' and `goucode` LIKE  '%$code%'");
                //本来的中奖码对应的记录
                $str=str_replace($code,$ex_code[0],$tempinfo['goucode']);
                $db->Query("update `@#_member_go_record` set goucode='$str' where id='{$tempinfo['id']}'");
                //将系统原来的中奖吗对应的购买记录换成指定中奖会员购买的code
                $str2=str_replace($ex_code[0],$code,$ex_info['goucode']);
                $db->Query("update `@#_member_go_record` set goucode='$str2' where id='{$ex_info['id']}'");
                //将指定中奖会员的购买记录中的code换成系统计算出来的中奖吗
                */
                //添加时间校准
                if (!empty($chazhi)) {
                    $last_info = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}' order by id desc limit 1");
                    $time_t_str = str_replace('.', '', $last_info['time']);
                    $time_str = bcadd($time_t_str, $chazhi);
                    $time_arr = str_split($time_str, 10);
                    $str_t_time = $time_arr[0] . '.' . $time_arr[1];
                    $db->Query("UPDATE `@#_member_go_record` SET `time`='{$str_t_time}' where `id` = '{$last_info['id']}'");
                    $tocode = System::load_app_class("tocode", "pay");
                    $tocode->shop = $shop;
                    $tocode->run_tocode($time, 100, $shop['canyurenshu'], $shop);
                    $content = addslashes($tocode->go_content);
                }
            }
        }
    }
    /////////////////
    $u_go_info = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}' and `goucode` LIKE  '%{$code}%'");
    $u_info = $db->GetOne("select uid,username,email,mobile,img from `@#_member` where `uid` = '{$u_go_info['uid']}'");
    //更新商品
    $query = true;
    if ($u_info) {
        $u_info['username'] = _htmtocode($u_info['username']);
        $q_user = serialize($u_info);
        $gtimes = (int) System::load_sys_config('system', 'goods_end_time');
        if ($gtimes == 0 || $gtimes == 1) {
            $q_showtime = 'N';
        } else {
            $q_showtime = 'Y';
        }
        $sqlss = "UPDATE `@#_shoplist` SET\n\t\t\t\t\t\t\t`canyurenshu`=`zongrenshu`,\n\t\t\t\t\t\t\t`shenyurenshu` = '0',\n\t\t\t\t\t\t\t`q_uid` = '{$u_info['uid']}',\n\t\t\t\t\t\t\t`q_user` = '{$q_user}',\n\t\t\t\t\t\t\t`q_user_code` = '{$code}',\n\t\t\t\t\t\t\t`q_content`\t= '{$content}',\n\t\t\t\t\t\t\t`q_counttime` ='{$counttime}',\n\t\t\t\t\t\t\t`q_end_time` = '{$time}',\n\t\t\t\t\t\t\t`q_showtime` = '{$q_showtime}'\n\t\t\t\t\t\t\t where `id` = '{$shop['id']}'";
        $q = $db->Query($sqlss);
        if (!$q) {
            $query = false;
        }
        if ($q) {
            $q = $db->Query("UPDATE `@#_member_go_record` SET `huode` = '{$code}' where `id` = '{$u_go_info['id']}' and `code` = '{$u_go_info['code']}' and `uid` = '{$u_go_info['uid']}' and `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}'");
            if (!$q) {
                $query = false;
            } else {
                $post_arr = array("uid" => $u_info['uid'], "gid" => $shop['id'], "send" => 1);
                _g_triggerRequest(WEB_PATH . '/api/send/send_shop_code', false, $post_arr);
            }
        } else {
            $query = false;
        }
    } else {
        $query = false;
    }
    /******************************/
    /*新建*/
    if ($query) {
        if ($shop['qishu'] < $shop['maxqishu']) {
            $maxinfo = $db->GetOne("select * from `@#_shoplist` where `sid` = '{$shop['sid']}' order by `qishu` DESC LIMIT 1");
            if (!$maxinfo) {
                $maxinfo = array("qishu" => $shop['qishu']);
            }
            if (!$maxinfo) {
                $maxinfo = array("qishu" => $shop['qishu']);
                System::load_app_fun("content", G_ADMIN_DIR);
                $intall = content_add_shop_install($maxinfo, false);
                if (!$intall) {
                    return $query;
                }
            } else {
                if ($maxinfo['id'] == $shop['id']) {
                    System::load_app_fun("content", G_ADMIN_DIR);
                    $intall = content_add_shop_install($maxinfo, false);
                    if (!$intall) {
                        return $query;
                    }
                }
            }
        }
    }
    return $query;
}
Ejemplo n.º 25
0
function pay_insert_shop($shop = '', $type = '')
{
    $time = sprintf("%.3f", microtime(true) + (int) System::load_sys_config('system', 'goods_end_time'));
    $db = System::load_sys_class("model");
    if ($shop['xsjx_time'] != '0') {
        return $db->Query("UPDATE `@#_shoplist` SET `canyurenshu`=`zongrenshu`,\t`shenyurenshu` = '0' where `id` = '{$shop['id']}'");
    }
    $tocode = System::load_app_class("tocode", "pay");
    $tocode->shop = $shop;
    $tocode->run_tocode($time, 100, $shop['canyurenshu'], $shop);
    $code = $tocode->go_code;
    $content = addslashes($tocode->go_content);
    $counttime = $tocode->count_time;
    $u_go_info = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}' and `goucode` LIKE  '%{$code}%'");
    $u_info = $db->GetOne("select uid,username,email,mobile,img from `@#_member` where `uid` = '{$u_go_info['uid']}'");
    //更新商品
    $query = true;
    if ($u_info) {
        $u_info['username'] = _htmtocode($u_info['username']);
        $q_user = serialize($u_info);
        $gtimes = (int) System::load_sys_config('system', 'goods_end_time');
        if ($gtimes == 0 || $gtimes == 1) {
            $q_showtime = 'N';
        } else {
            $q_showtime = 'Y';
        }
        $sqlss = "UPDATE `@#_shoplist` SET \n\t\t\t\t\t\t\t`canyurenshu`=`zongrenshu`,\n\t\t\t\t\t\t\t`shenyurenshu` = '0',\n\t\t\t\t\t\t\t`q_uid` = '{$u_info['uid']}',\n\t\t\t\t\t\t\t`q_user` = '{$q_user}',\n\t\t\t\t\t\t\t`q_user_code` = '{$code}',\n\t\t\t\t\t\t\t`q_content`\t= '{$content}',\n\t\t\t\t\t\t\t`q_counttime` ='{$counttime}',\n\t\t\t\t\t\t\t`q_end_time` = '{$time}',\n\t\t\t\t\t\t\t`q_showtime` = '{$q_showtime}'\n\t\t\t\t\t\t\t where `id` = '{$shop['id']}'";
        $q = $db->Query($sqlss);
        if (!$q) {
            $query = false;
        }
        if ($q) {
            $q = $db->Query("UPDATE `@#_member_go_record` SET `huode` = '{$code}' where `id` = '{$u_go_info['id']}' and `code` = '{$u_go_info['code']}' and `uid` = '{$u_go_info['uid']}' and `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}'");
            if (!$q) {
                $query = false;
            } else {
                $post_arr = array("uid" => $u_info['uid'], "gid" => $shop['id'], "send" => 1);
                _g_triggerRequest(WEB_PATH . '/api/send/send_shop_code', false, $post_arr);
            }
        } else {
            $query = false;
        }
    } else {
        $query = false;
    }
    /******************************/
    /*新建*/
    if ($query) {
        if ($shop['qishu'] < $shop['maxqishu']) {
            $maxinfo = $db->GetOne("select * from `@#_shoplist` where `sid` = '{$shop['sid']}' order by `qishu` DESC LIMIT 1");
            if (!$maxinfo) {
                $maxinfo = array("qishu" => $shop['qishu']);
            }
            System::load_app_fun("content", G_ADMIN_DIR);
            $intall = content_add_shop_install($maxinfo, false);
            if (!$intall) {
                return $query;
            }
        }
    }
    return $query;
}
Ejemplo n.º 26
0
 public function mobile_temp()
 {
     $config = System::load_sys_config("mobile");
     /*注册验资*/
     $temp_reg = $this->db->GetOne("select value from `@#_caches` where `key` = 'template_mobile_reg' LIMIT 1");
     /*获奖*/
     $temp_shop = $this->db->GetOne("select value from `@#_caches` where `key` = 'template_mobile_shop' LIMIT 1");
     if (isset($_POST['dosubmit'])) {
         $m_reg_temp = $_POST['m_reg_temp'];
         $m_shop_temp = $_POST['m_shop_temp'];
         preg_match_all("/./us", $m_reg_temp, $match_reg);
         if (count($match_reg[0]) >= 75) {
             _message("注册验资短信模板不能超过75个字,请检查!");
         }
         preg_match_all("/./us", $m_shop_temp, $match_shop);
         if (count($match_shop[0]) >= 75) {
             _message("用户获奖短信模板不能超过75个字,请检查!");
         }
         $q_1 = $this->db->Query("UPDATE `@#_caches` SET `value`='{$_POST['m_reg_temp']}' WHERE (`key`='template_mobile_reg')");
         $q_2 = $this->db->Query("UPDATE `@#_caches` SET `value`='{$_POST['m_shop_temp']}' WHERE (`key`='template_mobile_shop')");
         if ($q_1 && $q_2) {
             _message("短信模板更新成功!");
         } else {
             _message("短信模板更新失败!");
         }
     }
     include $this->tpl(ROUTE_M, 'template.mobile');
 }
Ejemplo n.º 27
0
 public function register()
 {
     $config_email = System::load_sys_config("email");
     $config_mobile = System::load_sys_config("mobile");
     $regconfig = System::load_app_config("user_reg_type", "", ROUTE_M);
     if ($this->userinfo) {
         header("Location:" . WEB_PATH . "/member/home/");
         exit;
     }
     if (isset($_POST['submit'])) {
         $name = isset($_POST['name']) ? $_POST['name'] : "";
         $userpassword = isset($_POST['userpassword']) ? $_POST['userpassword'] : "";
         $userpassword2 = isset($_POST['userpassword2']) ? $_POST['userpassword2'] : "";
         if ($name == null or $userpassword == null or $userpassword2 == null) {
             _message("帐号密码不能为空", null, 3);
         }
         if (!(_checkmobile($name) or _checkemail($name))) {
             _message("帐号不是手机或邮箱", null, 3);
         }
         if (strlen($userpassword) < 6 || strlen($userpassword) > 20) {
             _message("密码小于6位或大于20位", null, 3);
         }
         if ($userpassword != $userpassword2) {
             _message("两次密码不一致", null, 3);
         }
         $regtype = null;
         if (_checkmobile($name)) {
             $regtype = 'mobile';
             $cfg_mobile_type = 'cfg_mobile_' . $config_mobile['cfg_mobile_on'];
             $config_mobile = $config_mobile[$cfg_mobile_type];
             if (empty($config_mobile['mid']) && empty($config_email['mpass'])) {
                 _message("系统短信配置不正确!");
             }
         }
         if (_checkemail($name)) {
             $regtype = 'email';
             if (empty($config_email['user']) && empty($config_email['pass'])) {
                 _message("系统邮箱配置不正确!");
             }
         }
         //验证注册类型
         $regtype_arr = System::load_app_config("user_reg_type", "", ROUTE_M);
         $regtypes = 'reg_' . $regtype;
         if (empty($regtype) || $regtype_arr[$regtypes] == 0) {
             if ($regtype == 'email') {
                 _message("网站未开启邮箱注册!", null, 3);
             }
             if ($regtype == 'mobile') {
                 _message("网站未开启手机注册!", null, 3);
             }
             _message("您注册的类型不正确!", null, 3);
         }
         $member = $this->db->GetOne("SELECT * FROM `@#_member` WHERE `{$regtype}` = '{$name}' or `reg_key` = '{$name}' LIMIT 1");
         if (is_array($member) && $member[$regtype] == $name) {
             _message("该账号已被注册!", WEB_PATH . '/register');
         }
         $register_type = 'def';
         if (is_array($member) && $member['reg_key'] == $name) {
             $b_uid = $member['uid'];
             $b_user = $this->db->GetOne("SELECT * FROM `@#_member_band` WHERE `b_uid` = '{$b_uid}' LIMIT 1");
             if (is_array($b_user)) {
                 _message("该账号已被注册!", WEB_PATH . '/register');
             }
             $register_type = 'for';
             //未注册成功在次注册
         }
         $time = time();
         $userpassword = md5($userpassword);
         $codetype = $regtype . 'code';
         $regcode = $this->segment(4);
         $regcode = !empty($regcode) ? $regcode : $_COOKIE['regcode'];
         $decode = _encrypt($regcode, "DECODE");
         $decode = intval($decode);
         //邮箱验证 -1 代表未验证, 1 验证成功 都不等代表等待验证
         if ($register_type == 'def') {
             $ip = _get_ip();
             $day_time = strtotime(date("Y-m-d"));
             $member_reg_num = $this->db->GetNum("SELECT uid FROM `@#_member` where `time` > '{$day_time}' and `user_ip` LIKE '%{$ip}%'");
             if ($member_reg_num >= $regconfig['reg_num']) {
                 _message("您今日注册会员数已经达到上限!");
             }
             $user_ip = _get_ip_dizhi();
             $sql = "INSERT INTO `@#_member`(password,user_ip,img,emailcode,mobilecode,reg_key,yaoqing,time)VALUES('{$userpassword}','{$user_ip}','photo/member.jpg','-1','-1','{$name}','{$decode}','{$time}')";
             $sqlreg = $this->db->Query($sql);
             $check_code = serialize(array("name" => $name, "time" => $time));
             $check_code = _encrypt($check_code, "ENCODE", '', 3600 * 24);
         } elseif ($register_type == 'for') {
             $sqlreg = true;
             $check_code = serialize(array("name" => $name, "time" => $member['time']));
             $check_code = _encrypt($check_code, "ENCODE", '', 3600 * 24);
         }
         if ($sqlreg) {
             header("location:" . WEB_PATH . "/member/user/" . $regtype . "check" . "/" . $check_code);
             exit;
         } else {
             _message("注册失败!", WEB_PATH . '/register');
         }
     }
     $p_c = $this->segment(4);
     if (!empty($p_c)) {
         setcookie("regcode", $p_c, time() + 3600 * 24 * 7);
     }
     $title = "注册" . _cfg("web_name");
     include templates("user", "register");
 }
Ejemplo n.º 28
0
    public function empower()
    {
        if (isset($_POST['dosubmit'])) {
            $code = isset($_POST['code']) ? $_POST['code'] : null;
            if ($code == null) {
                _message('您输入的授权码格式不正确!');
            }
            $code = strtoupper($code);
            $check = @fopen("http://www.yungoucms.com/get.php?set_code={$code}", "r");
            if (!$check) {
                _message('您输入的授权码不正确!');
            }
            $html = "\n\t\t\t\t<?php \n\t\t\t\t\treturn array('code' => '{$code}');\n\t\t\t\t?>\n\t\t\t";
            $path = G_CONFIG . '/' . 'code.inc.php';
            file_put_contents($path, $html);
            _message("绑定成功");
        }
        $code = System::load_sys_config("code", "code");
        if ($code) {
            echo <<<HTML
\t\t\t<iframe src="http://www.yungoucms.com/get.php?code={$code}" width="100%" height="100%" scrolling="no"  style=" border:0px;background:#fff; text-align:center"></iframe>
HTML;
        } else {
            include $this->tpl(ROUTE_M, 'config.empower');
        }
    }
Ejemplo n.º 29
0
 private function getsize($size = 0, $xi = false)
 {
     $maxsize = System::load_sys_config('upload', 'upsize');
     if ($size > $maxsize || $size < 1) {
         $size = $maxsize;
     }
     $units = array(3 => 'G', 2 => 'M', 1 => 'KB', 0 => 'B');
     //单位字符,可类推添加更多字符.
     $str = '';
     foreach ($units as $i => $unit) {
         if ($i > 0) {
             $n = $size / pow(1024, $i) % pow(1024, $i);
         } else {
             $n = $size;
         }
         if ($n != 0) {
             $str .= " {$n}{$unit} ";
             if (!$xi) {
                 return $str;
             }
         }
     }
     return $str;
 }
Ejemplo n.º 30
0
 /**
  * 解析PC标签
  * @param string $op 操作方式
  * @param string $data 参数
  * @param string $html 匹配到的所有的HTML代码
  */
 private static function pc_tag($op, $data, $html)
 {
     static $display = array("op" => false, "page" => false);
     $datas = array();
     $html = '';
     $modarr = array("mod", "sql", "page", "cache", "return", "one");
     preg_match_all("/([a-z]+)\\=[\"]?([^\"]+)[\"]?/i", stripslashes($data), $matches, PREG_SET_ORDER);
     foreach ($matches as $v) {
         $datas[$v[1]] = $v[2];
         if (in_array($v[1], $modarr)) {
             ${$v}[1] = $v[2];
             continue;
         }
     }
     $CacheTime = System::load_sys_config("system", "cache");
     $datas['mod'] = $mod = isset($mod) && trim($mod) ? trim($mod) : 'get';
     $datas['sql'] = $sql = isset($sql) && trim($sql) ? trim($sql) : '';
     $datas['page'] = $page = isset($page) ? true : false;
     $datas['cache'] = $cache = isset($cache) && intval($cache) ? intval($cache) : intval($CacheTime);
     $datas['return'] = $return = isset($return) && trim($return) ? trim($return) : 'data';
     $datas['one'] = $one = isset($one) && trim($one) ? true : false;
     if (!file_exists(G_SYSTEM . 'model' . DIRECTORY_SEPARATOR . $op . '_tag.class.php')) {
         exit('Model File Error:' . ' File Not Found');
     }
     if ($page && !$display['page']) {
         $display['page'] = true;
         $html .= '<?php $page=System::load_sys_class("page"); ?>';
     }
     $html .= '<?php ';
     if ($op && !$display['op']) {
         $display['op'] = true;
         $html .= '$' . $op . '_tag';
         $html .= '=System::load_app_model("' . $op . '_tag");';
     }
     if ($op) {
         $html .= 'if(method_exists($' . $op . '_tag,"' . $mod . '")){';
         $html .= '$' . $return . '=$' . $op . '_tag->' . $mod . '(' . self::arr_to_html($datas) . ');} ?>';
     }
     return $html;
 }