투표 권한 추가

This commit is contained in:
2018-06-19 01:42:40 +09:00
parent 746977d5d0
commit 5c738f97ed
2 changed files with 13 additions and 7 deletions
+9 -6
View File
@@ -12,6 +12,9 @@ $connect=$db->get();
increaseRefresh("설문조사", 1); increaseRefresh("설문조사", 1);
$isVoteAdmin = in_array('vote', $session->acl[DB::prefix()]??[]);
$isVoteAdmin |= $session->userGrade >= 5;
$query = "select no,vote from general where owner='{$userID}'"; $query = "select no,vote from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -57,7 +60,7 @@ function captureKey(e) {
<tr><td colspan=3 align=center id=bg2><font size=5>설 문 조 사 (<?=$admin['develcost']*5?>금과 추첨으로 유니크템 증정!)</font></td></tr> <tr><td colspan=3 align=center id=bg2><font size=5>설 문 조 사 (<?=$admin['develcost']*5?>금과 추첨으로 유니크템 증정!)</font></td></tr>
<?php <?php
if ($session->userGrade >= 5) { if ($isVoteAdmin) {
echo " echo "
<tr> <tr>
<td width=48 align=center><input type=submit name=btn value='알림'></td> <td width=48 align=center><input type=submit name=btn value='알림'></td>
@@ -96,7 +99,7 @@ for ($i=1; $i < $voteTypeCount; $i++) {
echo " echo "
<input type=radio name=sel value={$i}> <input type=radio name=sel value={$i}>
"; ";
} elseif ($admin['voteopen'] >= 1 || $session->userGrade >= 5) { } elseif ($admin['voteopen'] >= 1 || $isVoteAdmin) {
$query = "select no from general where vote='{$i}'"; $query = "select no from general where vote='{$i}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$vCount = MYDB_num_rows($result); $vCount = MYDB_num_rows($result);
@@ -132,7 +135,7 @@ echo "
</tr> </tr>
"; ";
if ($session->userGrade >= 5) { if ($isVoteAdmin) {
echo " echo "
<tr> <tr>
<td align=center><input type=submit name=btn value='리셋'></td> <td align=center><input type=submit name=btn value='리셋'></td>
@@ -184,7 +187,7 @@ if ($me['no'] > 0) {
<tr><td colspan=3 align=center id=bg2><font size=5> <tr><td colspan=3 align=center id=bg2><font size=5>
전 체 통 계 전 체 통 계
<?php <?php
if ($session->userGrade >= 5) { if ($isVoteAdmin) {
echo " echo "
<input type=submit name=btn value='숨김'> <input type=submit name=btn value='숨김'>
<input type=submit name=btn value='전체통계만'> <input type=submit name=btn value='전체통계만'>
@@ -193,7 +196,7 @@ if ($session->userGrade >= 5) {
echo " echo "
</font></td></tr>"; </font></td></tr>";
if ($admin['voteopen'] >= 1 || $session->userGrade >= 5) { if ($admin['voteopen'] >= 1 || $isVoteAdmin) {
echo " echo "
<tr> <tr>
<td width=130 align=center>전 체</td> <td width=130 align=center>전 체</td>
@@ -258,7 +261,7 @@ if ($admin['voteopen'] >= 1 || $session->userGrade >= 5) {
"; ";
} }
if ($admin['voteopen'] >= 2 || $session->userGrade >= 5) { if ($admin['voteopen'] >= 2 || $isVoteAdmin) {
$query = "select no from general where nation=0 and npc<2"; $query = "select no from general where nation=0 and npc<2";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$memCount = MYDB_num_rows($result); $memCount = MYDB_num_rows($result);
+4 -1
View File
@@ -16,6 +16,9 @@ extractMissingPostToGlobals();
$session = Session::requireGameLogin()->setReadOnly(); $session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID(); $userID = Session::getUserID();
$isVoteAdmin = in_array('vote', $session->acl[DB::prefix()]??[]);
$isVoteAdmin |= $session->userGrade >= 5;
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get(); $connect=$db->get();
@@ -47,7 +50,7 @@ else if($btn == "댓글" && trim($comment) != "") {
$gameStor->votecomment = $admin['votecomment']; $gameStor->votecomment = $admin['votecomment'];
} }
if($session->userGrade < 5){ if(!$isVoteAdmin){
header('location:a_vote.php'); header('location:a_vote.php');
die(); die();
} }