Skip to content

Commit

Permalink
Checked PSR-1 / PHP 8.1 Undefiend Varialbe, Type error
Browse files Browse the repository at this point in the history
  • Loading branch information
KimTom89 committed May 31, 2022
1 parent 993e689 commit 1fb9b50
Show file tree
Hide file tree
Showing 13 changed files with 1,032 additions and 988 deletions.
4 changes: 2 additions & 2 deletions adm/phpinfo.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
$sub_menu = "100500";
include_once('./_common.php');
require_once './_common.php';

check_demo();

auth_check_menu($auth, $sub_menu, 'r');

phpinfo();
phpinfo();
318 changes: 162 additions & 156 deletions adm/point_list.php

Large diffs are not rendered by default.

26 changes: 14 additions & 12 deletions adm/point_list_delete.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$sub_menu = '200200';
include_once('./_common.php');
require_once './_common.php';

check_demo();

Expand All @@ -9,11 +9,11 @@
check_admin_token();

$count = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
if(!$count)
alert($_POST['act_button'].' 하실 항목을 하나 이상 체크하세요.');
if (!$count) {
alert($_POST['act_button'] . ' 하실 항목을 하나 이상 체크하세요.');
}

for ($i=0; $i<$count; $i++)
{
for ($i = 0; $i < $count; $i++) {
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$po_id = (int) $_POST['po_id'][$k];
Expand All @@ -23,19 +23,21 @@
$sql = " select * from {$g5['point_table']} where po_id = '{$po_id}' ";
$row = sql_fetch($sql);

if(!$row['po_id'])
if (!$row['po_id']) {
continue;
}

if($row['po_point'] < 0) {
if ($row['po_point'] < 0) {
$mb_id = $row['mb_id'];
$po_point = abs($row['po_point']);

if($row['po_rel_table'] == '@expire')
if ($row['po_rel_table'] == '@expire') {
delete_expire_point($mb_id, $po_point);
else
} else {
delete_use_point($mb_id, $po_point);
}
} else {
if($row['po_use_point'] > 0) {
if ($row['po_use_point'] > 0) {
insert_use_point($row['mb_id'], $row['po_use_point'], $row['po_id']);
}
}
Expand All @@ -53,8 +55,8 @@

// 포인트 UPDATE
$sum_point = get_point_sum($_POST['mb_id'][$k]);
$sql= " update {$g5['member_table']} set mb_point = '$sum_point' where mb_id = '{$str_mb_id}' ";
$sql = " update {$g5['member_table']} set mb_point = '$sum_point' where mb_id = '{$str_mb_id}' ";
sql_query($sql);
}

goto_url('./point_list.php?'.$qstr);
goto_url('./point_list.php?' . $qstr);
18 changes: 10 additions & 8 deletions adm/point_update.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
<?php
$sub_menu = "200200";
include_once('./_common.php');
require_once './_common.php';

auth_check_menu($auth, $sub_menu, 'w');

check_admin_token();

$mb_id = isset($_POST['mb_id']) ? strip_tags(clean_xss_attributes($_POST['mb_id'])) : '';
$po_point = isset($_POST['po_point']) ? strip_tags(clean_xss_attributes($_POST['po_point'])) : 0;
$po_point = isset($_POST['po_point']) ? (int)strip_tags(clean_xss_attributes($_POST['po_point'])) : 0;
$po_content = isset($_POST['po_content']) ? strip_tags(clean_xss_attributes($_POST['po_content'])) : '';
$expire = isset($_POST['po_expire_term']) ? preg_replace('/[^0-9]/', '', $_POST['po_expire_term']) : '';

$mb = get_member($mb_id);

if (!$mb['mb_id'])
alert('존재하는 회원아이디가 아닙니다.', './point_list.php?'.$qstr);
if (!$mb['mb_id']) {
alert('존재하는 회원아이디가 아닙니다.', './point_list.php?' . $qstr);
}

if (($po_point < 0) && ($po_point * (-1) > $mb['mb_point']))
alert('포인트를 깎는 경우 현재 포인트보다 작으면 안됩니다.', './point_list.php?'.$qstr);
if (($po_point < 0) && ($po_point * (-1) > $mb['mb_point'])) {
alert('포인트를 깎는 경우 현재 포인트보다 작으면 안됩니다.', './point_list.php?' . $qstr);
}

insert_point($mb_id, $po_point, $po_content, '@passive', $mb_id, $member['mb_id'].'-'.uniqid(''), $expire);
insert_point($mb_id, $po_point, $po_content, '@passive', $mb_id, $member['mb_id'] . '-' . uniqid(''), $expire);

goto_url('./point_list.php?'.$qstr);
goto_url('./point_list.php?' . $qstr);
9 changes: 5 additions & 4 deletions adm/poll_delete.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$sub_menu = "200900";
include_once('./_common.php');
require_once './_common.php';

check_demo();

Expand All @@ -10,10 +10,11 @@

$count = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;

if(!$count)
if (!$count) {
alert('삭제할 투표목록을 1개이상 선택해 주세요.');
}

for($i=0; $i<$count; $i++) {
for ($i = 0; $i < $count; $i++) {
$po_id = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0;

$sql = " delete from {$g5['poll_table']} where po_id = '$po_id' ";
Expand All @@ -23,4 +24,4 @@
sql_query($sql);
}

goto_url('./poll_list.php?'.$qstr);
goto_url('./poll_list.php?' . $qstr);
196 changes: 99 additions & 97 deletions adm/poll_form.php
Original file line number Diff line number Diff line change
@@ -1,121 +1,123 @@
<?php
$sub_menu = "200900";
include_once('./_common.php');
require_once './_common.php';

auth_check_menu($auth, $sub_menu, 'w');

$po_id = isset($po_id) ? (int) $po_id : 0;
$po = array(
'po_subject'=>'',
'po_etc'=>'',
'po_level'=>'',
'po_point'=>'',
'po_subject' => '',
'po_etc' => '',
'po_level' => '',
'po_point' => '',
);

$html_title = '투표';
if ($w == '')
if ($w == '') {
$html_title .= ' 생성';
else if ($w == 'u') {
} elseif ($w == 'u') {
$html_title .= ' 수정';
$sql = " select * from {$g5['poll_table']} where po_id = '{$po_id}' ";
$po = sql_fetch($sql);
} else
} else {
alert('w 값이 제대로 넘어오지 않았습니다.');
}

$g5['title'] = $html_title;
include_once('./admin.head.php');
require_once './admin.head.php';
?>

<form name="fpoll" id="fpoll" action="./poll_form_update.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="po_id" value="<?php echo $po_id ?>">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="token" value="">

<div class="tbl_frm01 tbl_wrap">

<table>
<caption><?php echo $g5['title']; ?></caption>
<tbody>
<tr>
<th scope="row"><label for="po_subject">투표 제목<strong class="sound_only">필수</strong></label></th>
<td><input type="text" name="po_subject" value="<?php echo get_sanitize_input($po['po_subject']); ?>" id="po_subject" required class="required frm_input" size="80" maxlength="125"></td>
</tr>

<?php
for ($i=1; $i<=9; $i++) {
$required = '';
if ($i==1 || $i==2) {
$required = 'required';
$sound_only = '<strong class="sound_only">필수</strong>';
}

$po_poll = isset($po['po_poll'.$i]) ? get_text($po['po_poll'.$i]) : '';
$po_cnt = isset($po['po_cnt'.$i]) ? get_text($po['po_cnt'.$i]) : 0;
?>

<tr>
<th scope="row"><label for="po_poll<?php echo $i ?>">항목 <?php echo $i ?><?php echo $sound_only ?></label></th>
<td>
<input type="text" name="po_poll<?php echo $i ?>" value="<?php echo $po_poll ?>" id="po_poll<?php echo $i ?>" <?php echo $required ?> class="frm_input <?php echo $required ?>" maxlength="125">
<label for="po_cnt<?php echo $i ?>">항목 <?php echo $i ?> 투표수</label>
<input type="text" name="po_cnt<?php echo $i ?>" value="<?php echo $po_cnt; ?>" id="po_cnt<?php echo $i ?>" class="frm_input" size="3">
</td>
</tr>

<?php } ?>

<tr>
<th scope="row"><label for="po_etc">기타의견</label></th>
<td>
<?php echo help('기타 의견을 남길 수 있도록 하려면, 간단한 질문을 입력하세요.') ?>
<input type="text" name="po_etc" value="<?php echo get_text($po['po_etc']) ?>" id="po_etc" class="frm_input" size="80" maxlength="125">
</td>
</tr>
<tr>
<th scope="row"><label for="po_level">투표가능 회원레벨</label></th>
<td>
<?php echo help("레벨을 1로 설정하면 손님도 투표할 수 있습니다.") ?>
<?php echo get_member_level_select('po_level', 1, 10, $po['po_level']) ?> 이상 투표할 수 있음
</td>
</tr>
<tr>
<th scope="row"><label for="po_point">포인트</label></th>
<td>
<?php echo help('투표에 참여한 회원에게 포인트를 부여합니다.') ?>
<input type="text" name="po_point" value="<?php echo $po['po_point'] ?>" id="po_point" class="frm_input">
</td>
</tr>

<?php if ($w == 'u') { ?>
<tr>
<th scope="row">투표등록일</th>
<td><?php echo $po['po_date']; ?></td>
</tr>
<tr>
<th scope="row"><label for="po_ips">투표참가 IP</label></th>
<td><textarea name="po_ips" id="po_ips" readonly rows="10"><?php echo preg_replace("/\n/", " / ", $po['po_ips']) ?></textarea></td>
</tr>
<tr>
<th scope="row"><label for="mb_ids">투표참가 회원</label></th>
<td><textarea name="mb_ids" id="mb_ids" readonly rows="10"><?php echo preg_replace("/\n/", " / ", $po['mb_ids']) ?></textarea></td>
</tr>
<?php } ?>
</tbody>
</table>

</div>

<div class="btn_fixed_top ">
<a href="./poll_list.php?<?php echo $qstr ?>" class="btn_02 btn">목록</a>
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
</div>
<input type="hidden" name="po_id" value="<?php echo $po_id ?>">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="token" value="">

<div class="tbl_frm01 tbl_wrap">

<table>
<caption><?php echo $g5['title']; ?></caption>
<tbody>
<tr>
<th scope="row"><label for="po_subject">투표 제목<strong class="sound_only">필수</strong></label></th>
<td><input type="text" name="po_subject" value="<?php echo get_sanitize_input($po['po_subject']); ?>" id="po_subject" required class="required frm_input" size="80" maxlength="125"></td>
</tr>

<?php
for ($i = 1; $i <= 9; $i++) {
$required = '';
$sound_only = '';
if ($i == 1 || $i == 2) {
$required = 'required';
$sound_only = '<strong class="sound_only">필수</strong>';
}

$po_poll = isset($po['po_poll' . $i]) ? get_text($po['po_poll' . $i]) : '';
$po_cnt = isset($po['po_cnt' . $i]) ? get_text($po['po_cnt' . $i]) : 0;
?>

<tr>
<th scope="row"><label for="po_poll<?php echo $i ?>">항목 <?php echo $i ?><?php echo $sound_only ?></label></th>
<td>
<input type="text" name="po_poll<?php echo $i ?>" value="<?php echo $po_poll ?>" id="po_poll<?php echo $i ?>" <?php echo $required ?> class="frm_input <?php echo $required ?>" maxlength="125">
<label for="po_cnt<?php echo $i ?>">항목 <?php echo $i ?> 투표수</label>
<input type="text" name="po_cnt<?php echo $i ?>" value="<?php echo $po_cnt; ?>" id="po_cnt<?php echo $i ?>" class="frm_input" size="3">
</td>
</tr>

<?php } ?>

<tr>
<th scope="row"><label for="po_etc">기타의견</label></th>
<td>
<?php echo help('기타 의견을 남길 수 있도록 하려면, 간단한 질문을 입력하세요.') ?>
<input type="text" name="po_etc" value="<?php echo get_text($po['po_etc']) ?>" id="po_etc" class="frm_input" size="80" maxlength="125">
</td>
</tr>
<tr>
<th scope="row"><label for="po_level">투표가능 회원레벨</label></th>
<td>
<?php echo help("레벨을 1로 설정하면 손님도 투표할 수 있습니다.") ?>
<?php echo get_member_level_select('po_level', 1, 10, $po['po_level']) ?> 이상 투표할 수 있음
</td>
</tr>
<tr>
<th scope="row"><label for="po_point">포인트</label></th>
<td>
<?php echo help('투표에 참여한 회원에게 포인트를 부여합니다.') ?>
<input type="text" name="po_point" value="<?php echo $po['po_point'] ?>" id="po_point" class="frm_input">
</td>
</tr>

<?php if ($w == 'u') { ?>
<tr>
<th scope="row">투표등록일</th>
<td><?php echo $po['po_date']; ?></td>
</tr>
<tr>
<th scope="row"><label for="po_ips">투표참가 IP</label></th>
<td><textarea name="po_ips" id="po_ips" readonly rows="10"><?php echo preg_replace("/\n/", " / ", $po['po_ips']) ?></textarea></td>
</tr>
<tr>
<th scope="row"><label for="mb_ids">투표참가 회원</label></th>
<td><textarea name="mb_ids" id="mb_ids" readonly rows="10"><?php echo preg_replace("/\n/", " / ", $po['mb_ids']) ?></textarea></td>
</tr>
<?php } ?>
</tbody>
</table>

</div>

<div class="btn_fixed_top ">
<a href="./poll_list.php?<?php echo $qstr ?>" class="btn_02 btn">목록</a>
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
</div>

</form>

<?php
include_once('./admin.tail.php');
require_once './admin.tail.php';
Loading

0 comments on commit 1fb9b50

Please sign in to comment.