Example #1
0
<?php

require_once 'config.php';
require_once $yjl_tpath . 'setting/settings.php';
require_once 'function.php';
$isgl = 0;
if ($udb['uid'] > 0) {
    if ($udb['qx'] == 10) {
        $isgl = 2;
        if (!isset($_COOKIE[$config['cookie_prefix'] . 'ajhAuth']) || $_COOKIE[$config['cookie_prefix'] . 'ajhAuth'] == '') {
            if (!isset($config['safe_key'])) {
                $config['safe_key'] = '';
            }
            $ajhAuthKey = md5($config['auth_key'] . $_SERVER['HTTP_USER_AGENT'] . '_IN_ADMIN_PANEL_' . date('Y-m-Y-m') . '_' . $config['safe_key']);
            $aac = yjl_authcode("{$udb['password']}\t{$udb['uid']}", 'ENCODE', $ajhAuthKey);
            setcookie($config['cookie_prefix'] . 'ajhAuth', $aac, time() + 365 * 86400);
        }
    } elseif ($udb['isxg'] > 0) {
        $isgl = 1;
    }
}
if ($isgl > 0) {
    ?>
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php 
    echo $r_main['site_name'];
Example #2
0
function yjl_chkulog()
{
    global $_COOKIE, $config, $_SERVER, $dbprefix, $yjl_dbprefix, $a_userzd;
    $udb = array('uid' => 0);
    if (isset($_COOKIE[$config['cookie_prefix'] . 'auth']) && $_COOKIE[$config['cookie_prefix'] . 'auth'] != '') {
        $lk = yjl_authcode($_COOKIE[$config['cookie_prefix'] . 'auth'], 'DECODE', $config['auth_key']);
        $ak = explode("\t", $lk);
        if (isset($ak[0]) && trim($ak[0]) != '' && isset($ak[1]) && intval($ak[1]) > 0) {
            //登录验证成功
        } else {
            return $udb;
        }
    } else {
        return $udb;
    }
    //新版修改
    //$uid = checkSession();
    global $config;
    $hostname_conn = $config['db_host'];
    $database_conn = $config['db_name'];
    $username_conn = $config['db_user'];
    $password_conn = $config['db_pass'];
    $dbprefix = $config['db_table_prefix'];
    $conn = mysql_connect($hostname_conn, $username_conn, $password_conn) or die(mysql_error());
    mysql_select_db($database_conn, $conn);
    //if ($uid) {
    //$q_res=sprintf('select * from %s where uid=%s limit 1', $dbprefix.'members', $uid);
    $q_res = sprintf('select * from %s where uid=%s and password=%s limit 1', $dbprefix . 'members', yjl_SQLString($ak[1], 'int'), yjl_SQLString(trim($ak[0]), 'text'));
    $res = mysql_query($q_res) or die(mysql_error());
    $r_res = mysql_fetch_assoc($res);
    //print_r($q_res);die;
    if (mysql_num_rows($res) > 0) {
        $q_rep = sprintf('select * from %s where uid=%s limit 1', $yjl_dbprefix . 'members', $r_res['uid']);
        $rep = mysql_query($q_rep) or die(mysql_error());
        $r_rep = mysql_fetch_assoc($rep);
        if (mysql_num_rows($rep) > 0) {
            foreach ($a_userzd as $k => $v) {
                $r_res[$k] = $r_rep[$k];
            }
        } else {
            $r_res['qx'] = $r_res['role_id'] == 2 ? 10 : 0;
            $r_res['iswc'] = $r_res['qx'] == 10 ? 1 : 0;
            foreach ($a_userzd as $k => $v) {
                if (!isset($r_res[$k])) {
                    $r_res[$k] = $v;
                }
            }
            //新版修改 添加isnc,nc
            //$iSQL=sprintf("insert into %s (uid, qx, isnc, nc) values (%s, %s, 1, '%s')", $yjl_dbprefix.'members',
            //$r_res['uid'], $r_res['qx'], $r_res['nickname']);
            $iSQL = sprintf("insert into %s (uid, qx) values (%s, %s)", $yjl_dbprefix . 'members', $r_res['uid'], $r_res['qx']);
            //echo $iSQL;
            $result = mysql_query($iSQL);
        }
        mysql_free_result($rep);
        $udb = $r_res;
        if ($udb['qx'] == 5 || $udb['qx'] == 6) {
            $q_rep = sprintf('select uid from %s where uid=%s limit 1', $yjl_dbprefix . 'ujl', $udb['uid']);
            $rep = mysql_query($q_rep) or die(mysql_error());
            if (mysql_num_rows($rep) == 0) {
                $iSQL = sprintf('insert into %s (uid) values (%s)', $yjl_dbprefix . 'ujl', $udb['uid']);
                $repult = mysql_query($iSQL) or die(mysql_error());
            }
            mysql_free_result($rep);
        } elseif ($udb['qx'] == 0) {
            $q_rep = sprintf('select uid from %s where uid=%s limit 1', $yjl_dbprefix . 'uyz', $udb['uid']);
            $rep = mysql_query($q_rep) or die(mysql_error());
            if (mysql_num_rows($rep) == 0) {
                $iSQL = sprintf('insert into %s (uid) values (%s)', $yjl_dbprefix . 'uyz', $udb['uid']);
                $repult = mysql_query($iSQL) or die(mysql_error());
            }
            mysql_free_result($rep);
        }
        //同步登录新版
        syn_login($r_res);
    }
    mysql_free_result($res);
    //}
    return $udb;
}