사이트 내 전체검색
그누보드
[팁] [펌] 아이디 => 이메일 형식으로 회원가입 및 로그인
하우코드
https://cmd.kr/gnu/735 URL이 복사되었습니다.

본문

출처: https://sir.kr/g5_tip/14485

아이디 => 이메일 형식으로 회원가입 및 로그인
 koreanleo2020.09.25 16:31:41조회 3,619댓글 19
관련링크
 http://koreanleo.com/bbs/board.php?bo_table=php&wr_id=24 226회
검색목록목록글쓰기
1. lib/common.lib.php
파일에 함수 생성
 

function get_email($mb_id, $fields='*', $is_cache=false){

    global $g5;

   

    // $mb_id = preg_replace("/[^0-9a-z_]+/i", "", $mb_id);

 

    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];

}

 


2.ajax.mb_id.php파일

if ($msg = valid_mb_id($mb_id))    die($msg);


 G5_LIB_PATH.'/register.lib.php' => valid_mb_id()함수 커스터마이징
 

function valid_mb_id($reg_mb_id)

{

   

    if (!preg_match("/([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/", $reg_mb_id))

        return "E-mail 주소가 형식에 맞지 않습니다.";

    else

        return "";

}


3. jquery.register_form.js 파일

reg_mb_id_check 함수 data 부분 아래와 같이 변경
 

  data: {

            "reg_mb_id": $("#reg_mb_id").val()

        },



4.login.check.php 파일
 

// $mb = get_member($mb_id);

$mb = get_email($mb_id);

다음과 같이 변경

5. member_form.php 파일

 // $mb = get_member($mb_id);

    $mb = get_email($mb_id);

다음과 같이 변경
6. root/ common.php
 

    // $member = get_member($_SESSION['ss_mb_id']);

    $member = get_email($_SESSION['ss_mb_id']);

다음과 같이 변경







update `g5_config` set `cf_admin` = 'admin@test.com' where `cf_admin` = "admin";

관리자도 메일 형식으로 바꿔주세요


*추가

데이터 베이스에 mb_id 부분들은 꼭 char 255로 해주세요.
회원디비, 게시판디비등 mb_id가 들어가는 부분들은 전부 (20)으로  되어있어서
아이디 짤려서 들어갑니다!

댓글목록

등록된 댓글이 없습니다.

그누보드
190 (1/4P)

Search

Copyright © Cmd 명령어 3.147.238.70