체크박스 작동을 안해요....
본문
<?php
$sub_menu = '100000';
require_once './_common.php';
@require_once './safe_check.php';
if (function_exists('social_log_file_delete')) {
social_log_file_delete(86400); //소셜로그인 디버그 파일 24시간 지난것은 삭제
}
$g5['title'] = '관리자메인';
require_once './admin.head.php';
$sql_common = " from {$g5['member_table']} ";
$sql_search = " where (1) ";
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
case 'mb_point':
$sql_search .= " ({$sfl} >= '{$stx}') ";
break;
case 'mb_level':
$sql_search .= " ({$sfl} = '{$stx}') ";
break;
case 'mb_tel':
case 'mb_hp':
$sql_search .= " ({$sfl} like '%{$stx}') ";
break;
default:
$sql_search .= " ({$sfl} like '{$stx}%') ";
break;
}
$sql_search .= " ) ";
}
if ($is_admin != 'super') {
$sql_search .= " and mb_level <= '{$member['mb_level']}' ";
}
if (!$sst) {
$sst = "mb_datetime";
$sod = "desc";
}
$sql_order = " order by {$sst} {$sod} ";
$sql = " select count(*) as cnt {$sql_common} {$sql_search} {$sql_order} ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) {
$page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
}
$from_record = ($page - 1) * $rows; // 시작 열을 구함
// 탈퇴회원수
$sql = " select count(*) as cnt {$sql_common} {$sql_search} and mb_leave_date <> '' {$sql_order} ";
$row = sql_fetch($sql);
$leave_count = $row['cnt'];
// 차단회원수
$sql = " select count(*) as cnt {$sql_common} {$sql_search} and mb_intercept_date <> '' {$sql_order} ";
$row = sql_fetch($sql);
$intercept_count = $row['cnt'];
$listall = '<a href="' . $_SERVER['SCRIPT_NAME'] . '" class="ov_listall">전체목록</a>';
$g5['title'] = '회원관리';
require_once './admin.head.php';
$sql = " select * {$sql_common} {$sql_search} {$sql_order} limit {$from_record}, {$rows} ";
$result = sql_query($sql);
$colspan = 16;
?>
<!--셀러관리-->
<section id="con_main_container">
<div class="con_main11">
<div class="cm11_wrap">
<div class="cm11_top">
<div class="cm11_left">
<input type="radio" checked>
<span>사용중인 셀러 <?php echo number_format($total_count) ?>명 </span>
<span>/</span>
<input type="radio" checked>
<span>대기 <?php
$sql_waiting_count = "SELECT COUNT(*) AS cnt FROM {$g5['member_table']} WHERE mb_level = '2'";
$row_waiting_count = sql_fetch($sql_waiting_count);
$waiting_count = $row_waiting_count['cnt'];
echo number_format($waiting_count);
?>명</span>
</div>
<div class="cm11_right">
<select>
<option value="defalt" selected>총판선택</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<select>
<option value="1" selected>레벨선택</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<select>
<option value="대분류">상태선택</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select>
<option value="대분류">무료전체</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
</div>
<form id="fsearch" name="fsearch" class="local_sch01 local_sch" method="get">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="sfl">
<option value="mb_id" <?php echo get_selected($sfl, "mb_id"); ?>>회원아이디</option>
<option value="mb_nick" <?php echo get_selected($sfl, "mb_nick"); ?>>닉네임</option>
<option value="mb_name" <?php echo get_selected($sfl, "mb_name"); ?>>이름</option>
<option value="mb_level" <?php echo get_selected($sfl, "mb_level"); ?>>권한</option>
<option value="mb_email" <?php echo get_selected($sfl, "mb_email"); ?>>E-MAIL</option>
<option value="mb_tel" <?php echo get_selected($sfl, "mb_tel"); ?>>전화번호</option>
<option value="mb_hp" <?php echo get_selected($sfl, "mb_hp"); ?>>휴대폰번호</option>
<option value="mb_point" <?php echo get_selected($sfl, "mb_point"); ?>>포인트</option>
<option value="mb_datetime" <?php echo get_selected($sfl, "mb_datetime"); ?>>가입일시</option>
<option value="mb_ip" <?php echo get_selected($sfl, "mb_ip"); ?>>IP</option>
<option value="mb_recommend" <?php echo get_selected($sfl, "mb_recommend"); ?>>추천인</option>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="<?php echo $stx ?>" id="stx" required class="required frm_input" placeholder="검색어를 입력하세요">
<input type="submit" class="black_sbtn" value="검색">
</form>
<form name="fmemberlist" id="fmemberlist" action="./member_list_update.php" onsubmit="return fmemberlist_submit(this);" method="post">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="token" value="">
<div class="cm11_mid">
<table>
<thead>
<tr>
<th scope="col" id="mb_list_chk" rowspan="2">
<label for="chkall" class="sound_only">회원 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<th>번호</th>
<th scope="col" id="mb_list_deny"><?php echo subject_sort_link('mb_level', '', 'desc') ?>등급</a></th>
<th scope="col" id="mb_list_nick"><?php echo subject_sort_link('mb_nick') ?>닉네임</a></th>
<th scope="col" id="mb_list_id"><?php echo subject_sort_link('mb_id') ?>아이디</a></th>
<th scope="col" id="mb_list_name"><?php echo subject_sort_link('mb_name') ?>회원명</a></th>
<th scope="col" id="mb_list_tel"><?php echo subject_sort_link('mb_tel') ?>연락처</a></th>
<th>메모(클릭)</th>
<th scope="col" id="mb_list_ip"><?php echo subject_sort_link('mb_ip') ?>접속아이피</a></th>
<th scope="col" id="mb_list_lastcall"><?php echo subject_sort_link('mb_today_login', '', 'desc') ?>최종로그인</a></th>
<th>상태</th>
<th scope="col" id="mb_list_join"><?php echo subject_sort_link('mb_datetime', '', 'desc') ?>등록일</a></th>
<th>사용료,가입비/무료</th>
<th scope="col" rowspan="2" id="mb_list_mng">수정</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $row = sql_fetch_array($result); $i++) {
// 접근가능한 그룹수
$sql2 = " select count(*) as cnt from {$g5['group_member_table']} where mb_id = '{$row['mb_id']}' ";
$row2 = sql_fetch($sql2);
$group = '';
if ($row2['cnt']) {
$group = '<a href="./boardgroupmember_form.php?mb_id=' . $row['mb_id'] . '">' . $row2['cnt'] . '</a>';
}
if ($is_admin == 'group') {
$s_mod = '';
} else {
$s_mod = '<a href="./member_form.php?' . $qstr . '&w=u&mb_id=' . $row['mb_id'] . '" class="btn btn_03">수정</a>';
}
$s_grp = '<a href="./boardgroupmember_form.php?mb_id=' . $row['mb_id'] . '" class="btn btn_02">그룹</a>';
?>
<tr class="<?php echo $bg; ?>">
<td headers="mb_list_chk" class="td_chk">
<input type="hidden" name="mb_id[<?php echo $i ?>]" value="<?php echo $row['mb_id'] ?>" id="mb_id_<?php echo $i ?>">
<label for="chk_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['mb_name']); ?> <?php echo get_text($row['mb_nick']); ?>님</label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
</td>
<td><?php echo $row['mb_no']; ?></td>
<td headers="mb_list_auth" class="td_mbstat">
<?php echo get_member_level_select("mb_level[$i]", 1, $member['mb_level'], $row['mb_level']) ?>
</td>
<td><?php echo get_text($row['mb_nick']); ?></td>
<td><?php echo $row['mb_id']; ?></td>
<td><?php echo get_text($row['mb_name']); ?></td>
<td><?php echo $row['mb_tel']; ?></td>
<td>
<a href="javascript:void(0);" onclick="openPopup('<?php echo $row['mb_id']?>');" class="btn">보기</a>
</td>
<td><?php echo get_text($row['mb_ip']); ?></td>
<td><?php echo substr($row['mb_today_login'], 2, 8); ?></td>
<td></td>
<td><?php echo $row['mb_datetime']; ?></td>
<td></td>
<td id="mb_list_mng">
<?php echo $s_mod; ?>
</td>
</tr>
<?php
}
if ($i == 0) {
echo "<tr><td colspan=\"6\" class=\"empty_table\">자료가 없습니다.</td></tr>";
}
?>
</tbody>
<div class="btn_fixed_top">
<input type="submit" name="act_button" value="선택수정" onclick="document.pressed=this.value" class="btn btn_02">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
</div>
</table>
</div>
</div>
</div>
</section>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, '?' . $qstr . '&page='); ?>
<script>
function fmemberlist_submit(f) {
if (!is_checked(f,"chk[]")) {
alert(document.pressed + " 하실 항목을 하나 이상 선택하세요.");
return false;
}
if (document.pressed == "선택삭제") {
if (!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
return true;
}
$('#all-check').click(() => {
$('.items').prop('checked',$('#all-check').is(':checked'));
});
function openPopup(mb_id) {
var url = 'memo_list.php?mb_id=' + encodeURIComponent(mb_id);
window.open(url, '_blank', 'width=500,height=500');
}
</script>
<?php
require_once './admin.tail.php';
체크박스를 선택하고 선택수정을 누르면 계속 체크박스를 선택하라고 나오는데 도움을 주실 수 있으신가요ㅠㅠ
!-->답변 4
그럼....
function fmemberlist_submit(f) {
if (!is_checked(f."chk[]")) {
alert(document.pressed + " 하실 항목을 하나 이상 선택하세요.");
return false;
}
f 다음에 콤마(,)를 점(.)으로 바꿔보세요...
function fmemberlist_submit(f) {
if (!is_checked(f,"chk[]")) {
alert(document.pressed + " 하실 항목을 하나 이상 선택하세요.");
return false;
}
여기를.....
function fmemberlist_submit(f) {
if (!is_checked("chk[]")) {
alert(document.pressed + " 하실 항목을 하나 이상 선택하세요.");
return false;
}
로 바꿔보세요....
<!--셀러관리-->
<section id="con_main_container">
<div class="con_main11">
<div class="cm11_wrap">
<div class="cm11_top">
<div class="cm11_left">
<input type="radio" checked>
<span>사용중인 셀러 <?php echo number_format($total_count) ?>명 </span>
<span>/</span>
<input type="radio" checked>
<span>대기 <?php
$sql_waiting_count = "SELECT COUNT(*) AS cnt FROM {$g5['member_table']} WHERE mb_level = '2'";
$row_waiting_count = sql_fetch($sql_waiting_count);
$waiting_count = $row_waiting_count['cnt'];
echo number_format($waiting_count);
?>명</span>
</div>
<div class="cm11_right">
<select>
<option value="defalt" selected>총판선택</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<select>
<option value="1" selected>레벨선택</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<select>
<option value="대분류">상태선택</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select>
<option value="대분류">무료전체</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
</div>
<form id="fsearch" name="fsearch" class="local_sch01 local_sch" method="get">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="sfl">
<option value="mb_id" <?php echo get_selected($sfl, "mb_id"); ?>>회원아이디</option>
<option value="mb_nick" <?php echo get_selected($sfl, "mb_nick"); ?>>닉네임</option>
<option value="mb_name" <?php echo get_selected($sfl, "mb_name"); ?>>이름</option>
<option value="mb_level" <?php echo get_selected($sfl, "mb_level"); ?>>권한</option>
<option value="mb_email" <?php echo get_selected($sfl, "mb_email"); ?>>E-MAIL</option>
<option value="mb_tel" <?php echo get_selected($sfl, "mb_tel"); ?>>전화번호</option>
<option value="mb_hp" <?php echo get_selected($sfl, "mb_hp"); ?>>휴대폰번호</option>
</select>
<input type="text" name="stx" value="<?php echo stripslashes($stx); ?>" id="stx" class="frm_input">
<input type="submit" value="검색" class="btn_submit">
</form>
<div class="tbl_head01 tbl_wrap">
<table>
<caption>회원리스트</caption>
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">회원 전체</label>
<input type="checkbox" id="chkall" onclick="check_all(this.form)" class="frm_input">
</th>
<th scope="col">회원아이디</th>
<th scope="col">닉네임</th>
<th scope="col">이름</th>
<th scope="col">권한</th>
<th scope="col">E-MAIL</th>
<th scope="col">전화번호</th>
<th scope="col">휴대폰번호</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $i < $count; $i++) {
$row = sql_fetch_array($result);
?>
<tr>
<td class="td_chk">
<input type="checkbox" id="chk_<?php echo $i; ?>" name="chk[]" value="<?php echo $row['mb_id']; ?>" class="frm_input">
</td>
<td><?php echo $row['mb_id']; ?></td>
<td><?php echo $row['mb_nick']; ?></td>
<td><?php echo $row['mb_name']; ?></td>
<td><?php echo $row['mb_level']; ?></td>
<td><?php echo $row['mb_email']; ?></td>
<td><?php echo $row['mb_tel']; ?></td>
<td><?php echo $row['mb_hp']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="local_ov01 local_ov">
<label for="chkall" class="sound_only">회원 전체</label>
<input type="checkbox" id="chkall" onclick="check_all(this.form)" class="frm_input">
선택된 회원을
<button type="submit" name="act_button" value="선택 삭제" onclick="document.pressed=this.value;" class="btn_submit">선택 삭제</button>
</div>
</div>
</div>
</div>
</section>
<script>
function check_all(f) {
for (var i=0; i<f.elements.length; i++) {
if (f.elements[i].name === "chk[]" && f.elements[i].id !== "chkall") {
f.elements[i].checked = f.elements[0].checked;
}
}
}
</script>
이렇게 하래요.
!-->
<?php
$sub_menu = '100000';
require_once './_common.php';
@require_once './safe_check.php';
if (function_exists('social_log_file_delete')) {
social_log_file_delete(86400); //소셜로그인 디버그 파일 24시간 지난 것은 삭제
}
$g5['title'] = '관리자메인';
require_once './admin.head.php';
$sql_common = " FROM {$g5['member_table']} ";
$sql_search = " WHERE (1) ";
if ($stx) {
$sql_search .= " AND ( ";
switch ($sfl) {
case 'mb_point':
$sql_search .= " ({$sfl} >= '{$stx}') ";
break;
case 'mb_level':
$sql_search .= " ({$sfl} = '{$stx}') ";
break;
case 'mb_tel':
case 'mb_hp':
$sql_search .= " ({$sfl} LIKE '%{$stx}') ";
break;
default:
$sql_search .= " ({$sfl} LIKE '{$stx}%') ";
break;
}
$sql_search .= " ) ";
}
if ($is_admin != 'super') {
$sql_search .= " AND mb_level <= '{$member['mb_level']}' ";
}
if (!$sst) {
$sst = "mb_datetime";
$sod = "DESC";
}
$sql_order = " ORDER BY {$sst} {$sod} ";
$sql = "SELECT COUNT(*) AS cnt {$sql_common} {$sql_search} {$sql_order}";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) {
$page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
}
$from_record = ($page - 1) * $rows; // 시작 열을 구함
// 탈퇴회원수
$sql = "SELECT COUNT(*) AS cnt {$sql_common} {$sql_search} AND mb_leave_date <> '' {$sql_order}";
$row = sql_fetch($sql);
$leave_count = $row['cnt'];
// 차단회원수
$sql = "SELECT COUNT(*) AS cnt {$sql_common} {$sql_search} AND mb_intercept_date <> '' {$sql_order}";
$row = sql_fetch($sql);
$intercept_count = $row['cnt'];
$listall = '<a href="' . $_SERVER['SCRIPT_NAME'] . '" class="ov_listall">전체목록</a>';
$g5['title'] = '회원관리';
require_once './admin.head.php';
$sql = "SELECT * {$sql_common} {$sql_search} {$sql_order} LIMIT {$from_record}, {$rows}";
$result = sql_query($sql);
$colspan = 16;
?>
<!--셀러관리-->
<section id="con_main_container">
<div class="con_main11">
<div class="cm11_wrap">
<div class="cm11_top">
<div class="cm11_left">
<input type="radio" checked>
<span>사용중인 셀러 <?php echo number_format($total_count) ?>명</span>
<span>/</span>
<input type="radio" checked>
<span>대기 <?php
$sql_waiting_count = "SELECT COUNT(*) AS cnt FROM {$g5['member_table']} WHERE mb_level = '2'";
$row_waiting_count = sql_fetch($sql_waiting_count);
$waiting_count = $row_waiting_count['cnt'];
echo number_format($waiting_count);
?>명</span>
</div>
<div class="cm11_right">
<select>
<option value="default" selected>총판선택</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<select>
<option value="1" selected>레벨선택</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<select>
<option value="대분류">상태선택</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select>
<option value="대분류">무료전체</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
</div>
<form id="fsearch" name="fsearch" class="local_sch01 local_sch" method="get">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="sfl">
<option value="mb_id" <?php echo get_selected($sfl, "mb_id"); ?>>회원아이디</option>
<option value="mb_nick" <?php echo get_selected($sfl, "mb_nick"); ?>>닉네임</option>
<option value="mb_name" <?php echo get_selected($sfl, "mb_name"); ?>>이름</option>
<option value="mb_level" <?php echo get_selected($sfl, "mb_level"); ?>>권한</option>
<option value="mb_email" <?php echo get_selected($sfl, "mb_email"); ?>>E-MAIL</option>
<option value="mb_tel" <?php echo get_selected($sfl, "mb_tel"); ?>>전화번호</option>
<option value="mb_hp" <?php echo get_selected($sfl, "mb_hp"); ?>>휴대폰번호</option>
</select>
<input type="text" name="stx" value="<?php echo stripslashes($stx); ?>" id="stx" class="frm_input">
<input type="submit" value="검색" class="btn_submit">
</form>
<div class="tbl_head01 tbl_wrap">
<table>
<caption>회원리스트</caption>
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">회원 전체</label>
<input type="checkbox" id="chkall" onclick="check_all(this.form)" class="frm_input">
</th>
<th scope="col">회원아이디</th>
<th scope="col">닉네임</th>
<th scope="col">이름</th>
<th scope="col">권한</th>
<th scope="col">E-MAIL</th>
<th scope="col">전화번호</th>
<th scope="col">휴대폰번호</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $i < $count; $i++) {
$row = sql_fetch_array($result);
?>
<tr>
<td class="td_chk">
<input type="checkbox" id="chk_<?php echo $i; ?>" name="chk[]" value="<?php echo $row['mb_id']; ?>" class="frm_input">
</td>
<td><?php echo $row['mb_id']; ?></td>
<td><?php echo $row['mb_nick']; ?></td>
<td><?php echo $row['mb_name']; ?></td>
<td><?php echo $row['mb_level']; ?></td>
<td><?php echo $row['mb_email']; ?></td>
<td><?php echo $row['mb_tel']; ?></td>
<td><?php echo $row['mb_hp']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="local_ov01 local_ov">
<label for="chkall" class="sound_only">회원 전체</label>
<input type="checkbox" id="chkall" onclick="check_all(this.form)" class="frm_input">
선택된 회원을
<button type="submit" name="act_button" value="선택 삭제" onclick="document.pressed=this.value;" class="btn_submit">선택 삭제</button>
</div>
</div>
</div>
</div>
</section>
<script>
function check_all(f) {
for (var i=0; i<f.elements.length; i++) {
if (f.elements[i].name === "chk[]" && f.elements[i].id !== "chkall") {
f.elements[i].checked = f.elements[0].checked;
}
}
}
</script>
<?php
require_once './admin.tail.php';
?>
코드가 길어서..
!-->
답변을 작성하시기 전에 로그인 해주세요.