IT 정보

그누보드/영카트 회원가입 이메일로 하기

jerry99 2024. 5. 31. 10:57

수정전 코드

// 회원 정보를 얻는다.
function get_member($mb_id, $fields = '*', $is_cache = false)
{
    global $g5;

    if (preg_match("/[^0-9a-z_]+/i", $mb_id))
        return array();

    static $cache = array();

    $key = md5($fields);

    if ($is_cache && isset($cache[$mb_id]) && isset($cache[$mb_id][$key])) {
        return $cache[$mb_id][$key];
    }

    $sql = " select $fields from {$g5['member_table']} where mb_id = TRIM('$mb_id') ";

    $cache[$mb_id][$key] = run_replace('get_member', sql_fetch($sql), $mb_id, $fields, $is_cache);

    return $cache[$mb_id][$key];
}

common.lib 에 있는 function get_member 부분 에서  

if (preg_match("/[^0-9a-z_]+/i", $mb_id)) return array();

부분을 주석처리함으로써 @표시를 이용 할 수있다.

추가적으로 기존 그누보드 DB에 mb_id 에 varchar의 사이즈를 키워줘야 한다.

 

수정 이후 코드

// 회원 정보를 얻는다.
function get_member($mb_id, $fields = '*', $is_cache = false)
{
    global $g5;

    /*if (preg_match("/[^0-9a-z_]+/i", $mb_id))
        return array();*/

    static $cache = array();

    $key = md5($fields);

    if ($is_cache && isset($cache[$mb_id]) && isset($cache[$mb_id][$key])) {
        return $cache[$mb_id][$key];
    }

    $sql = " select $fields from {$g5['member_table']} where mb_id = TRIM('$mb_id') ";

    $cache[$mb_id][$key] = run_replace('get_member', sql_fetch($sql), $mb_id, $fields, $is_cache);

    return $cache[$mb_id][$key];
}