아이콘, 게임 이미지 경로를 일괄 지정 가능하도록 변경
This commit is contained in:
+80
-58
@@ -12,15 +12,15 @@ $connect=$db->get();
|
||||
increaseRefresh("설문조사", 1);
|
||||
|
||||
$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);
|
||||
|
||||
$query = "select develcost,voteopen,vote,votecomment from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$vote = explode("|", $admin['vote']);
|
||||
if($vote[0] == "") {
|
||||
if ($vote[0] == "") {
|
||||
$vote[0] = "-";
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ function captureKey(e) {
|
||||
<tr><td colspan=3 align=center id=bg2><font size=5>설 문 조 사 (<?=$admin['develcost']*5?>금과 추첨으로 유니크템 증정!)</font></td></tr>
|
||||
<?php
|
||||
|
||||
if($session->userGrade >= 5) {
|
||||
if ($session->userGrade >= 5) {
|
||||
echo "
|
||||
<tr>
|
||||
<td width=48 align=center><input type=submit name=btn value='알림'></td>
|
||||
@@ -70,29 +70,29 @@ echo "
|
||||
";
|
||||
|
||||
$query = "select no from general where vote>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), "");
|
||||
$voteCount = MYDB_num_rows($result);
|
||||
|
||||
$query = "select no from general where npc<2";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$allCount = MYDB_num_rows($result);
|
||||
|
||||
$percentage = round($voteCount / $allCount * 100, 1);
|
||||
|
||||
$voteTypeCount = count($vote);
|
||||
for($i=1; $i < $voteTypeCount; $i++) {
|
||||
for ($i=1; $i < $voteTypeCount; $i++) {
|
||||
echo "
|
||||
<tr>
|
||||
<td width=48 align=center style=color:".getNewColor($i)."; bgcolor=".getColor($i).">{$i}.</td>
|
||||
<td width=48 align=center style=color:".getNewColor($i)."; bgcolor=".getVoteColor($i).">{$i}.</td>
|
||||
<td width=98 align=center>
|
||||
";
|
||||
if($me['vote'] == 0 && $me['no'] > 0) {
|
||||
if ($me['vote'] == 0 && $me['no'] > 0) {
|
||||
echo "
|
||||
<input type=radio name=sel value={$i}>
|
||||
";
|
||||
} elseif($admin['voteopen'] >= 1 || $session->userGrade >= 5) {
|
||||
} elseif ($admin['voteopen'] >= 1 || $session->userGrade >= 5) {
|
||||
$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);
|
||||
|
||||
$per = @round($vCount / $voteCount * 100, 1);
|
||||
@@ -111,7 +111,7 @@ for($i=1; $i < $voteTypeCount; $i++) {
|
||||
echo "
|
||||
<tr>
|
||||
";
|
||||
if($me['vote'] == 0 && $me['no'] > 0) {
|
||||
if ($me['vote'] == 0 && $me['no'] > 0) {
|
||||
echo "
|
||||
<td align=center>투표</td>
|
||||
<td align=center><input type=submit name=btn value='투표'></td>
|
||||
@@ -126,7 +126,7 @@ echo "
|
||||
</tr>
|
||||
";
|
||||
|
||||
if($session->userGrade >= 5) {
|
||||
if ($session->userGrade >= 5) {
|
||||
echo "
|
||||
<tr>
|
||||
<td align=center><input type=submit name=btn value='리셋'></td>
|
||||
@@ -136,7 +136,7 @@ if($session->userGrade >= 5) {
|
||||
";
|
||||
}
|
||||
|
||||
if($admin['votecomment'] != "") {
|
||||
if ($admin['votecomment'] != "") {
|
||||
$comment = explode("|", $admin['votecomment']);
|
||||
$commentCount = count($comment);
|
||||
} else {
|
||||
@@ -149,7 +149,7 @@ echo "
|
||||
<td colspan=4 align=center id=bg1>댓 글</td>
|
||||
</tr>
|
||||
";
|
||||
for($i=0; $i < $commentCount; $i++) {
|
||||
for ($i=0; $i < $commentCount; $i++) {
|
||||
$cmt = explode(":", $comment[$i]);
|
||||
$cmt[2] = Tag2Code($cmt[2]);
|
||||
$j = $i+1;
|
||||
@@ -162,7 +162,7 @@ for($i=0; $i < $commentCount; $i++) {
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
if($me['no'] > 0) {
|
||||
if ($me['no'] > 0) {
|
||||
echo "
|
||||
<tr>
|
||||
<td width=108 colspan=2 align=center>-</td>
|
||||
@@ -178,7 +178,7 @@ if($me['no'] > 0) {
|
||||
<tr><td colspan=3 align=center id=bg2><font size=5>
|
||||
전 체 통 계
|
||||
<?php
|
||||
if($session->userGrade >= 5) {
|
||||
if ($session->userGrade >= 5) {
|
||||
echo "
|
||||
<input type=submit name=btn value='숨김'>
|
||||
<input type=submit name=btn value='전체통계만'>
|
||||
@@ -187,7 +187,7 @@ if($session->userGrade >= 5) {
|
||||
echo "
|
||||
</font></td></tr>";
|
||||
|
||||
if($admin['voteopen'] >= 1 || $session->userGrade >= 5) {
|
||||
if ($admin['voteopen'] >= 1 || $session->userGrade >= 5) {
|
||||
echo "
|
||||
<tr>
|
||||
<td width=98 align=center>전 체</td>
|
||||
@@ -197,26 +197,43 @@ if($admin['voteopen'] >= 1 || $session->userGrade >= 5) {
|
||||
<tr>
|
||||
";
|
||||
|
||||
$query = "select no from general where npc<2";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$memCount = MYDB_num_rows($result);
|
||||
|
||||
$query = "select nation,vote from general where npc<2";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$count = MYDB_num_rows($result);
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$vote = MYDB_fetch_array($result);
|
||||
|
||||
$totalVote[$vote['vote']]++;
|
||||
if($vote['vote'] > 0) { $nationVoteCount[$vote['nation']]++; }
|
||||
$nationVote[$vote['nation']][$vote['vote']]++;
|
||||
$memCount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2');
|
||||
if ($memCount == 0) {
|
||||
$memCount = 1;
|
||||
}
|
||||
|
||||
for($i=0; $i < $voteTypeCount; $i++) {
|
||||
$per = @round($totalVote[$i] / $memCount * 100, 1);
|
||||
$totalVote = [];
|
||||
$nationVoteCount = [[0]];
|
||||
$nationVote = [[]];
|
||||
|
||||
foreach ($db->query("SELECT nation, vote, count(`no`) as cnt FROM general WHERE npc<2 GROUP BY nation, vote") as $row) {
|
||||
$nation = $row['nation'];
|
||||
$vote = $row['vote'];
|
||||
$cnt = $row['cnt'];
|
||||
|
||||
if (!isset($totalVote[$vote])) {
|
||||
$totalVote[$vote] = 0;
|
||||
}
|
||||
|
||||
if (!isset($nationVoteCount[$nation])) {
|
||||
$nationVoteCount[$nation] = 0;
|
||||
$nationVote[$nation] = [];
|
||||
}
|
||||
|
||||
if (!isset($nationVote[$nation][$vote])) {
|
||||
$nationVote[$nation][$vote] = 0;
|
||||
}
|
||||
|
||||
$totalVote[$vote] += $cnt;
|
||||
$nationVoteCount[$nation] += $cnt;
|
||||
$nationVote[$nation][$vote] += $cnt;
|
||||
}
|
||||
|
||||
for ($i=0; $i < $voteTypeCount; $i++) {
|
||||
$per = round(($totalVote[$i]??0) / $memCount * 100, 1);
|
||||
// if($per < 5) { $vote['cnt'] = " "; }
|
||||
echo "
|
||||
<td width={$per}% align=center style=color:".getNewColor($i)."; bgcolor=".getColor($i).">{$totalVote[$i]}</td>
|
||||
<td width={$per}% align=center style=color:".getNewColor($i)."; bgcolor=".getVoteColor($i).">{$totalVote[$i]}</td>
|
||||
";
|
||||
}
|
||||
|
||||
@@ -228,13 +245,18 @@ if($admin['voteopen'] >= 1 || $session->userGrade >= 5) {
|
||||
";
|
||||
}
|
||||
|
||||
if($admin['voteopen'] >= 2 || $session->userGrade >= 5) {
|
||||
if ($admin['voteopen'] >= 2 || $session->userGrade >= 5) {
|
||||
$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);
|
||||
if ($memCount == 0) {
|
||||
$memCount = 1;
|
||||
}
|
||||
|
||||
if(!$nationVoteCount[0]) { $nationVoteCount[0] = 0; }
|
||||
$percentage = @round($nationVoteCount[0] / $memCount * 100, 1);
|
||||
if (!isset($nationVoteCount[0])) {
|
||||
$nationVoteCount[0] = 0;
|
||||
}
|
||||
$percentage = round($nationVoteCount[0] / $memCount * 100, 1);
|
||||
|
||||
echo "
|
||||
<tr>
|
||||
@@ -245,11 +267,11 @@ if($admin['voteopen'] >= 2 || $session->userGrade >= 5) {
|
||||
<tr>
|
||||
";
|
||||
|
||||
for($i=0; $i < $voteTypeCount; $i++) {
|
||||
$per = @round($nationVote[0][$i] / $memCount * 100, 1);
|
||||
for ($i=0; $i < $voteTypeCount; $i++) {
|
||||
$per = round(Util::array_get($nationVote[0][$i], 0) / $memCount * 100, 1);
|
||||
// if($per < 5) { $vote['cnt'] = " "; }
|
||||
echo "
|
||||
<td width={$per}% align=center style=color:".getNewColor($i)."; bgcolor=".getColor($i).">{$nationVote[0][$i]}</td>
|
||||
<td width={$per}% align=center style=color:".getNewColor($i)."; bgcolor=".getVoteColor($i).">{$nationVote[0][$i]}</td>
|
||||
";
|
||||
}
|
||||
|
||||
@@ -261,32 +283,32 @@ if($admin['voteopen'] >= 2 || $session->userGrade >= 5) {
|
||||
";
|
||||
|
||||
$query = "select nation,color,name,gennum from nation order by gennum desc";
|
||||
$nationResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nationResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$nationcount = MYDB_num_rows($nationResult);
|
||||
for($i=0; $i < $nationcount; $i++) {
|
||||
for ($i=0; $i < $nationcount; $i++) {
|
||||
$nation = MYDB_fetch_array($nationResult);
|
||||
|
||||
$query = "select no from general where nation='{$nation['nation']}' 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);
|
||||
|
||||
if(!$nationVoteCount[$nation['nation']]) { $nationVoteCount[$nation['nation']] = 0; }
|
||||
$percentage = @round($nationVoteCount[$nation['nation']] / $memCount * 100, 1);
|
||||
$voteCount = $nationVoteCount[$nation['nation']] ?? 0;
|
||||
$percentage = round($voteCount / $memCount * 100, 1);
|
||||
|
||||
echo "
|
||||
<tr>
|
||||
<td align=center style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}>{$nation['name']}</td>
|
||||
<td align=center>{$nationVoteCount[$nation['nation']]} / {$memCount} ({$percentage} %)</td>
|
||||
<td align=center>{$voteCount} / {$memCount} ({$percentage} %)</td>
|
||||
<td align=center>
|
||||
<table align=center width=100% height=100% border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
|
||||
<tr>
|
||||
";
|
||||
|
||||
for($k=0; $k < $voteTypeCount; $k++) {
|
||||
$per = @round($nationVote[$nation['nation']][$k] / $memCount * 100, 1);
|
||||
for ($k=0; $k < $voteTypeCount; $k++) {
|
||||
$per = round($nationVote[$nation['nation']][$k] / $memCount * 100, 1);
|
||||
// if($per < 5) { $vote['cnt'] = " "; }
|
||||
echo "
|
||||
<td width={$per}% align=center style=color:".getNewColor($k)."; bgcolor=".getColor($k).">{$nationVote[$nation['nation']][$k]}</td>
|
||||
<td width={$per}% align=center style=color:".getNewColor($k)."; bgcolor=".getVoteColor($k).">{$nationVote[$nation['nation']][$k]}</td>
|
||||
";
|
||||
}
|
||||
|
||||
@@ -310,12 +332,13 @@ if($admin['voteopen'] >= 2 || $session->userGrade >= 5) {
|
||||
</html>
|
||||
|
||||
<?php
|
||||
function getColor($type) {
|
||||
if($type > 0) {
|
||||
function getVoteColor($type)
|
||||
{
|
||||
if ($type > 0) {
|
||||
$type = (($type - 1) % 7) + 1;
|
||||
}
|
||||
|
||||
switch($type) {
|
||||
switch ($type) {
|
||||
case 0: $color = "black"; break;
|
||||
case 1: $color = "red"; break;
|
||||
case 2: $color = "orange"; break;
|
||||
@@ -329,12 +352,13 @@ function getColor($type) {
|
||||
return $color;
|
||||
}
|
||||
|
||||
function getNewColor($type) {
|
||||
if($type > 0) {
|
||||
function getNewColor($type)
|
||||
{
|
||||
if ($type > 0) {
|
||||
$type = (($type - 1) % 7) + 1;
|
||||
}
|
||||
|
||||
switch($type) {
|
||||
switch ($type) {
|
||||
case 2: $color = "black"; break;
|
||||
case 3: $color = "black"; break;
|
||||
default:$color = "white"; break;
|
||||
@@ -342,5 +366,3 @@ function getNewColor($type) {
|
||||
|
||||
return $color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user