[php] 주차별 비밀번호 변경
본문
function toWeekNum($timestamp) {
$w = date('w', mktime(0,0,0, date('n',$timestamp), 1, date('Y',$timestamp)));
return ceil(($w + date('j',$timestamp) -1) / 7);
}
$weekNo = toWeekNum(time());
$weekNo1 = $weekNo - 1;
$todayset = strtotime(date("Y-m-d", strtotime("0 days", strtotime(G5_TIME_YMD))));
$yoil = date("w", $todayset);
$conf7 = explode("|", $config['cf_7']);
$conf6 = explode("|", $config['cf_6']);
if($yoil <= 4) {
switch($yoil) {
case "1":
$guest_mb = $conf6[0];
$guest_pw = $conf7[$weekNo1];
break;
case "2":
$guest_mb = $conf6[1];
$guest_pw = $conf7[$weekNo1];
break;
case "3":
$guest_mb = $conf6[2];
$guest_pw = $conf7[$weekNo1];
break;
case "4":
$guest_mb = $conf6[3];
$guest_pw = $conf7[$weekNo1];
break;
case "5":
case "6":
case "0":
$guest_mb = $conf6[4];
$guest_pw = $conf7[$weekNo1];
break;
}
//var_dump(" update {$g5['member_table']} set mb_password = '".$guest_pw."' where mb_id = '{$guest_mb}' ");
sql_query(" update {$g5['member_table']} set mb_password = '".get_encrypt_string($guest_pw)."' where mb_id = '{$guest_mb}' ");
sql_query(" update {$g5['config_table']} set cf_5 = '".$yoil."|".$guest_mb."|".$guest_pw."' ");
}
$w = date('w', mktime(0,0,0, date('n',$timestamp), 1, date('Y',$timestamp)));
return ceil(($w + date('j',$timestamp) -1) / 7);
}
$weekNo = toWeekNum(time());
$weekNo1 = $weekNo - 1;
$todayset = strtotime(date("Y-m-d", strtotime("0 days", strtotime(G5_TIME_YMD))));
$yoil = date("w", $todayset);
$conf7 = explode("|", $config['cf_7']);
$conf6 = explode("|", $config['cf_6']);
if($yoil <= 4) {
switch($yoil) {
case "1":
$guest_mb = $conf6[0];
$guest_pw = $conf7[$weekNo1];
break;
case "2":
$guest_mb = $conf6[1];
$guest_pw = $conf7[$weekNo1];
break;
case "3":
$guest_mb = $conf6[2];
$guest_pw = $conf7[$weekNo1];
break;
case "4":
$guest_mb = $conf6[3];
$guest_pw = $conf7[$weekNo1];
break;
case "5":
case "6":
case "0":
$guest_mb = $conf6[4];
$guest_pw = $conf7[$weekNo1];
break;
}
//var_dump(" update {$g5['member_table']} set mb_password = '".$guest_pw."' where mb_id = '{$guest_mb}' ");
sql_query(" update {$g5['member_table']} set mb_password = '".get_encrypt_string($guest_pw)."' where mb_id = '{$guest_mb}' ");
sql_query(" update {$g5['config_table']} set cf_5 = '".$yoil."|".$guest_mb."|".$guest_pw."' ");
}
추천0
댓글목록 0
등록된 댓글이 없습니다.