Example #1
0
如您有任何问题,请发邮件至 service@sylai.com或私信新浪微博账号: <a href="http://weibo.com/sylaicom">@乘亿科技</a> <br /><br /><br /><br /><br /><br />' . date("Y-m-d");
                //发送验证邮件,请设置了邮件信息后再取消注释
                //include_once(S_ROOT.'./source/function_sendmail.php');
                //$email_result=sendmail($email,$_SC['sitename'].'注册确认',$reg_msg);
                showmessage('请登录您的邮箱完成注册!');
                gourl('index.php');
                exit;
            } else {
                showmessage('表单有误,请重新填写!');
                $arr['err'] = 2;
                gourl('register.php');
                exit;
            }
        }
        $arr['err'] = 3;
        gourl('register.php');
        break;
    default:
        $smarty->display('register.dwt');
        break;
}
function email_reg($email, $backurl = '')
{
    global $_SGLOBAL, $_SC;
    $email_reg['email'] = $email;
    $email_reg['ip'] = getonlineip(1);
    $email_reg['salt'] = random(6);
    $email_reg['hash'] = substr(md5(md5($email) . $email_reg['salt']), 8, 7);
    $email_reg['addtime'] = $_SGLOBAL['timestamp'];
    $email_reg['used'] = 0;
    $email_reg['backurl'] = $backurl;
Example #2
0
<?php

include_once './common.php';
$url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
if ($_SGLOBAL['login'] == false) {
    gourl('index.php?backurl=' . urlencode($url));
    exit;
}
$datearr = array("天 ", "一 ", "二 ", "三 ", "四 ", "五 ", "六 ");
$ac = $_REQUEST["ac"];
switch ($ac) {
    case "msg_list":
        $op_wx = $_SGLOBAL['db']->getall('select * from ' . tname('open_member_weixin') . ' where op_uid=' . $_SGLOBAL['uid']);
        $uid = empty($_POST["uid"]) ? 0 : intval($_POST["uid"]);
        foreach ($op_wx as $k => $v) {
            $op_wxid[] = $v['id'];
        }
        $search_field = getstr($_POST['search_field']);
        $search_keyword = getstr($_POST['search_keyword']);
        $page = empty($_POST["page"]) ? 1 : intval($_POST["page"]);
        $pagesize = empty($_POST["pagesize"]) ? 10 : intval($_POST["pagesize"]);
        $querystr = "";
        $queryarray = array();
        $queryarray[] = 'm.uid=' . $uid;
        $queryarray[] = 'm.op_wxid ' . db_create_in($op_wxid);
        if ($search_keyword != "") {
            $queryarray[] = 'q.' . $search_field . " like '%" . $search_keyword . "%'";
        }
        //end if
        $querystr = "where 1=1";
        foreach ($queryarray as $k => $v) {
Example #3
0
require_once "admin_conn.php";
require_once "version.php";
$action = be("get", "action");
switch (trim($action)) {
    case "login":
        login();
        break;
    case "check":
        checkLogin();
        break;
    case "logout":
        logout();
        break;
    case "go":
        gourl();
        break;
    case "wel":
        chkLogin();
        headAdmin("欢迎页面");
        wel();
        break;
    default:
        chkLogin();
        main();
        break;
}
dispseObj();
function gourl()
{
    $url = be("get", "url");
Example #4
0
 /**
  * 获取用户称呼
  */
 private function nickname($uid = 0, $ty = '')
 {
     global $_W;
     return value($_COOKIE, 'run_username_' . intval($this->reply['rid']));
     //
     load()->model('mc');
     //获取会员资料
     $user = mc_fetch($uid ? $uid : $_W['member']['uid'], array('nickname', 'mobile', 'email', 'avatar'));
     if ($ty) {
         return $user[$ty];
     }
     $niemmo = '';
     if ($user) {
         $niemmo = $user['nickname'];
         if (empty($niemmo)) {
             $niemmo = $user['mobile'];
         }
         if (empty($niemmo)) {
             //$niemmo = cutstr($user['email'], 10);
             //
             $fans = pdo_fetch('SELECT acid,openid FROM ' . tablename('mc_mapping_fans') . ' WHERE openid = :openid AND uid = :uid', array(':openid' => $_W['openid'], ':uid' => $user['uid']));
             if ($fans) {
                 $acc = WeAccount::create($fans['acid']);
                 if (method_exists($acc, 'fetchAccountInfo')) {
                     $accinfo = $acc->fetchAccountInfo();
                     $access_token = iunserializer($accinfo['access_token']);
                     $accesstoken = $access_token['token'];
                     //
                     load()->func('communication');
                     $url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=' . $accesstoken . '&openid=' . $fans['openid'] . '&lang=zh_CN';
                     $response = ihttp_get($url);
                     if (!is_error($response)) {
                         $userinfo = json_decode($response['content'], true);
                         $niemmo = $userinfo['nickname'];
                         $userdata = array('nickname' => $userinfo['nickname'], 'gender' => $userinfo['sex'], 'avatar' => $userinfo['headimgurl'], 'resideprovince' => $userinfo['province'], 'residecity' => $userinfo['city'], 'nationality' => $userinfo['country']);
                         if (empty($userinfo['nickname'])) {
                             $url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $accinfo['key'] . '&redirect_uri=' . urlencode(urwdo('nickname', '', 1) . '&uid=' . $user['uid']) . '&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect';
                             gourl($url);
                         }
                         pdo_update('mc_members', $userdata, array('uid' => $user['uid']));
                     }
                 }
             }
         }
     }
     return $niemmo;
 }
Example #5
0
            $smarty->assign('account', $account);
        }
        //获取所有模块
        $modules = $_SGLOBAL['db']->getall('select * from ' . tname('open_module') . ' where ispublic=1');
        foreach ($modules as $k => $v) {
            $modules[$k]['enabled'] = getcount(tname('weixin_module'), array('op_uid' => $op_uid, 'op_wxid' => $id, 'mid' => $v['mid'], 'enabled' => 1));
        }
        $smarty->assign('modules', $modules);
        $smarty->display('wx_account_manage.dwt');
        break;
    case "del":
        $id = intval($_GET['id']) ? intval($_GET['id']) : 0;
        check_role($id);
        updatetable(tname('open_member_weixin'), array('password' => '', 'state' => -1), array('id' => $id));
        updatetable(tname('weixin_member'), array('state' => -1), array('op_wxid' => $id));
        gourl('wx_account.php');
        break;
    default:
        $total = getcount(tname('open_member_weixin'), array('op_uid' => $_SGLOBAL['uid']));
        $smarty->assign('total', $total);
        $account = $_SGLOBAL['db']->getall('select * from ' . tname('open_member_weixin') . ' where op_uid=' . $_SGLOBAL['uid'] . ' and state>-1');
        foreach ($account as $k => $v) {
            $account[$k]['weidian_state'] = $_SGLOBAL['db']->getone('select value from ' . tname('wz_weixin_setting') . ' where op_wxid=' . $v['id'] . ' and mid=1 and var="state"');
            $account[$k]['headimg'] = $_SC['img_url'] . '/weixin_headimg/' . $v['fakeid'] . '.png';
        }
        $smarty->assign('account', $account);
        $smarty->display('wx_account.dwt');
        break;
}
function check_role($id)
{
Example #6
0
<?php

include_once './common.php';
$backurl = empty($_POST['backurl']) ? 'user.php' : $_POST['backurl'];
if ($_SGLOBAL['login'] == false) {
    gourl($backurl);
    exit;
}
$type = !empty($_REQUEST['type']) ? intval($_REQUEST['type']) : 0;
$parent = !empty($_REQUEST['parent']) ? intval($_REQUEST['parent']) : 0;
$arr['regions'] = get_regions($type, $parent);
$arr['type'] = $type;
$arr['target'] = !empty($_REQUEST['target']) ? stripslashes(trim($_REQUEST['target'])) : '';
$arr['target'] = htmlspecialchars($arr['target']);
echo json_encode($arr);
/**
 * 获得指定国家的所有省份
 *
 * @access      public
 * @param       int     country    国家的编号
 * @return      array
 */
function get_regions($type = 0, $parent = 0)
{
    global $_SGLOBAL;
    $sql = "SELECT region_id, region_name FROM " . tname('region') . " WHERE region_type = '" . $type . "' AND parent_id = '" . $parent . "'";
    return $_SGLOBAL['db']->getall($sql);
}
Example #7
0
<?php

include_once './common.php';
gourl($_SC['site_host'] . '/appmsg/?id=' . $msg['id']);
exit;
Example #8
0
                    insertsession($setarr);
                    $cookietime = 0;
                    if ($_POST['remeber']) {
                        $cookietime = 3600 * 24 * 15;
                    }
                    //设置cookie
                    ssetcookie('auth', authcode($setarr["password"] . ' ' . $setarr["uid"], 'ENCODE'), $cookietime);
                    ssetcookie('loginuser', $rs['username'], $cookietime);
                    ssetcookie('_refer', '');
                    $arr['err'] = 0;
                    gourl($backurl);
                    exit;
                }
                //end if
            }
            //end if
            gourl($backurl);
            exit;
        } else {
            $arr['err'] = 4;
            // echo json_encode($arr);
            gourl($backurl);
            exit;
        }
        //end submitcheck
        break;
    default:
        gourl('index.php');
        exit;
        //$smarty->display('login.dwt');
}
Example #9
0
<?php

include_once './common.php';
$h = getstr($_GET['r']);
$hash = substr($h, 0, 7);
if ($hash != '') {
    gourl('r.php?h=' . $hash);
    exit;
}
if ($_SGLOBAL['login'] == true) {
    gourl('user.php');
    exit;
}
$smarty->display('index.dwt');
Example #10
0
<?php

include_once './common.php';
if ($_SGLOBAL['login'] == true) {
    $_SGLOBAL['login'] == false;
    clearcookie();
}
//end if
gourl('login.php');
exit;
Example #11
0
$hash = substr($h, 0, 7);
$email = $_SGLOBAL['db']->getone("select email from " . tname("open_email_reg") . " where hash='" . $hash . "' and addtime>'" . ($_SGLOBAL['timestamp'] - 24 * 3600) . "' and used=0");
include_once './source/function_user.php';
if (is_email($email)) {
    $query = $_SGLOBAL['db']->query("SELECT uid,username,state FROM " . tname("open_member") . " where email='" . $email . "'");
    $user = $_SGLOBAL['db']->fetch_array($query);
    if ($user) {
        updatetable(tname('open_member'), array('email_valid' => 1), array('uid' => $user['uid']));
        $backurl = $_SGLOBAL['db']->getone("select backurl from " . tname("open_email_reg") . " where hash='" . $hash . "' and addtime>'" . ($_SGLOBAL['timestamp'] - 24 * 3600) . "'");
        $backurl = empty($backurl) ? 'user.php' : $backurl;
        $setarr = array('uid' => $user["uid"], 'username' => addslashes($user['username']), 'password' => md5($user["uid"] . "|" . $_SGLOBAL["timestamp"]));
        //清理更新在线session
        insertsession($setarr);
        $cookietime = 0;
        $cookietime = 3600 * 24 * 15;
        //设置cookie
        ssetcookie('auth', authcode($setarr["password"] . ' ' . $setarr["uid"], 'ENCODE'), $cookietime);
        ssetcookie('loginuser', $user['username'], $cookietime);
        ssetcookie('_refer', '');
        //标记这个登录码使用次数
        $used = $_SGLOBAL['db']->getone("select used from " . tname("open_email_reg") . " where email='" . $email . "' and hash='" . $hash . "' and addtime>'" . ($_SGLOBAL['timestamp'] - 24 * 3600) . "'");
        $used = $used + 1;
        updatetable(tname('open_email_reg'), array('used' => $used), array('email' => $email));
        //页面跳转
        gourl($backurl);
        exit;
    }
}
showmessage('验证码错误或已经过期,请重新注册');
gourl('register.php?backurl=' . urlencode($backurl));
exit;
Example #12
0
 case "editprofile":
     $id = intval($_POST['id']) ? intval($_POST['id']) : 0;
     $wxid = $_SGLOBAL['db']->getone('select wxid from ' . tname('open_member_weixin_custommenu') . ' where id=' . $id);
     check_role($wxid);
     $setarr = array('sort_order' => intval($_POST['sort_order']) ? intval($_POST['sort_order']) : 0, 'btn_type' => intval($_POST['btn_type']) ? intval($_POST['btn_type']) : 0, 'btn_name' => getstr($_POST['btn_name']), 'keyword' => getstr($_POST['keyword']), 'url' => getstr($_POST['url']));
     updatetable(tname('open_member_weixin_custommenu'), $setarr, array('id' => $id));
     gourl('wx_custommenu.php?id=' . $wxid);
     exit;
     break;
 case "del":
     $id = intval($_GET['id']) ? intval($_GET['id']) : 0;
     $wxid = $_SGLOBAL['db']->getone('select wxid from ' . tname('open_member_weixin_custommenu') . ' where id=' . $id);
     check_role($wxid);
     $_SGLOBAL['db']->query('delete from ' . tname('open_member_weixin_custommenu') . ' where id=' . $id);
     $_SGLOBAL['db']->query('delete from ' . tname('open_member_weixin_custommenu') . ' where parent_id=' . $id);
     gourl('wx_custommenu.php?id=' . $wxid);
     break;
 case "update":
     $id = intval($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
     check_role($id);
     $list = $_SGLOBAL['db']->getall('select * from ' . tname('open_member_weixin_custommenu') . ' where parent_id=0 and wxid=' . $id . ' order by sort_order');
     foreach ($list as $k => $v) {
         $data['button'][$k]['name'] = urlencode($v['btn_name']);
         if ($v['btn_type'] == 1) {
             $data['button'][$k]['type'] = 'click';
             $data['button'][$k]['key'] = urlencode($v['keyword']);
         }
         if ($v['btn_type'] == 2) {
             $data['button'][$k]['type'] = 'view';
             $data['button'][$k]['url'] = urlencode($v['url']);
         }
Example #13
0
         exit;
     }
     $smarty->display('member_add.dwt');
     break;
 case "edit":
     $page = empty($_REQUEST["page"]) ? 1 : intval($_REQUEST["page"]);
     $smarty->assign('page', $page);
     $url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
     if ($_SGLOBAL['login'] == false) {
         gourl('index.php?backurl=' . urlencode($url));
         exit;
     }
     $uid = empty($_REQUEST['uid']) ? 0 : intval($_REQUEST['uid']);
     $check = getcount(tname("open_member_user"), array('op_uid' => $_SGLOBAL['uid'], 'uid' => $uid));
     if (!$check) {
         gourl('member.php');
         exit;
     }
     $query = $_SGLOBAL['db']->query("select * from " . tname('open_member_user') . " where uid=" . $uid);
     $profile = $_SGLOBAL['db']->fetch_array($query);
     $profile['gender_id'] = $profile['gender'];
     $profile['gender'] = $gender[$profile['gender']];
     if ($profile['avator'] == '') {
         $profile['avator'] = 'user1.jpg';
     }
     $profile['avator_file'] = $profile['avator'];
     $profile['avator'] = '/uploads/avators/' . $profile['avator'];
     $profile['country_id'] = $profile['country'];
     $profile['province_id'] = $profile['province'];
     $profile['city_id'] = $profile['city'];
     $profile['district_id'] = $profile['district'];
Example #14
0
                $reg_msg = '点击以下链接,登录' . $_SC['site_name'] . '进行修改密码:' . $email_reg_url;
                //发送验证邮件
                include_once S_ROOT . './source/function_sendmail.php';
                $email_result = sendmail($email, $_SC['site_name'] . '密码找回', $reg_msg);
                showmessage('找回邮件已经发送!');
                gourl('index.php');
                exit;
            } else {
                showmessage('找回邮件已经发送!');
                gourl('index.php');
                $arr['err'] = 2;
                exit;
            }
        }
        $arr['err'] = 3;
        gourl('forget.php');
        break;
    default:
        $smarty->display('forget.dwt');
        break;
}
function email_reg($email, $backurl = '')
{
    global $_SGLOBAL, $_SC;
    $email_reg['email'] = $email;
    $email_reg['ip'] = getonlineip(1);
    $email_reg['salt'] = random(6);
    $email_reg['hash'] = substr(md5(md5($email) . $email_reg['salt']), 8, 7);
    $email_reg['addtime'] = $_SGLOBAL['timestamp'];
    $email_reg['used'] = 0;
    $email_reg['backurl'] = $backurl;