Ejemplo n.º 1
0
function sms_send($mobile, $message, &$err)
{
    global $conf;
    $arr = array('0' => '发送成功', '1' => '发送成功', '-1' => '账号未注册', '-2' => '其他错误', '-3' => '密码错误', '-4' => '手机号格式不对', '-5' => '余额不足', '-6' => '定时发送时间不是有效的时间格式', '-7' => '提交信息末尾未加签名,请添加中文企业签名【 】', '-8' => '发送内容需在1到500个字之间', '-9' => '发送号码为空');
    $message = urlencode(iconv('UTF-8', 'GBK', $message . '【' . $conf['sitename'] . '】'));
    // 单条接口
    $s = "http://inolink.com/WS/Send.aspx?CorpID=xxx&Pwd=xxx&Mobile={$mobile}&Content={$message}&Cell=&SendTime=";
    // 批量发送接口
    //$s = "http://inolink.com/WS/BatchSend.aspx?CorpID=TCLKxxx&Pwd=xxx&Mobile=$mobile&Content=$message&Cell=&SendTime=";
    $r = http_get($s, 10, 3);
    xn_log($s . ',return:' . $r, 'sms');
    if ($r === FALSE) {
        $err = '短信网关超时';
        return FALSE;
    }
    if (!isset($arr[$r])) {
        $err = '网关返回的数据有问题' . $r;
        return FALSE;
    }
    if ($r == '1' || $r == '0') {
        return TRUE;
    } else {
        $err = $arr[$r];
        return $r;
    }
}
Ejemplo n.º 2
0
function db_maxid($table, $field, $abort = TRUE)
{
    global $db;
    $r = $db->maxid($table, $field);
    if ($r === FALSE && $db->errno != 0) {
        $s = "sql: {$sql}, sql errno: " . $db->errno . ", errstr: " . $db->errstr;
        xn_log($s, 'db_error');
        $abort and message(-1, $db->errstr);
    }
    return $r;
}
Ejemplo n.º 3
0
function plugin_official_list_cache()
{
    $s = cache_get('plugin_official_list');
    if ($s === NULL || DEBUG) {
        $url = "http://plugin.xiuno.com/plugin-list-version-3.htm";
        // 获取所有的插件,匹配到3.0以上的。
        $s = http_get($url, 30, 3);
        if (empty($s)) {
            xn_log('从官方获取插件数据失败。');
            return FALSE;
        }
        $r = xn_json_decode($s);
        if (!empty($r['servererror']) || !empty($r['code']) && $r['code'] != 0) {
            xn_log("从官方获取插件数据格式不对。");
            return FALSE;
        }
        $s = !empty($r['message']) ? $r['message'] : $r;
        cache_set('plugin_official_list', $s, 3600);
        // 缓存时间 1 小时。
    }
    return $s;
}
Ejemplo n.º 4
0
                message(1, '用户名不存在');
            }
            if (md5($password . $user['salt']) != $user['password']) {
                xn_log('password error. uid:' . $user['uid'] . ' - ******' . substr($password, -6), 'admin_login_error');
                message(2, '密码错误');
            }
            // gid 不合格的用户不允许登录
            if ($user['gid'] != 1) {
                xn_log('login illegal. uid:' . $user['uid'], 'admin_login_error');
                message(1, '无权访问');
            }
            // 更新登录信息
            user_update($user['uid'], array('login_ip' => $longip, 'login_date' => $time, 'logins+' => 1));
            user_token_set($user['uid'], $user['gid'], $user['password'], $user['avatar'], $user['username'], 'bbs');
            // 记录日志
            xn_log('login successed. uid:' . $user['uid'], 'admin_login');
            unset($user['password']);
            unset($user['password_sms']);
            unset($user['salt']);
            message(0, $user);
        }
    }
} elseif ($action == 'logout') {
    user_token_clean('/', '', 'bbs');
    header('Location:index-login.htm');
    exit;
} elseif ($action == 'phpinfo') {
    phpinfo();
    exit;
} else {
    $header['title'] = '后台管理';