티스토리 뷰

<html>

<head>

<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>

<link type="text/css" rel="stylesheet" href="./style.css" />

</head>

<?

mysql_query("set names utf8");

if($_GET['what'] && $_GET['str']){

$find = $_GET['what'];

$str = $_GET['str'];

$sql = mysql_query("select count(distinct IP) from mnormal_mode where $find like '%$str%'");

}else{

$sql = mysql_query("select count(distinct IP) from mnormal_mode");

}

$a = mysql_fetch_array($sql);

$total_num = $a[0];

if(!$_GET['maximum']){

$maximum = 10;

}else{

$maximum = $_GET['maximum'];

echo "<script>window.scrollTo(0,500);</script>";

}


$block_per_page = 5;

if($_GET['page']){ 

$page = $_GET['page']; 

echo "<script>window.scrollTo(0,500);</script>";

}else{

$page = 1;

}

$total_page = ceil($total_num / $maximum); // 전체 페이지 개수

$total_block = ceil($total_page / $block_per_page); // 전체 블록 개수

$now_block = ceil($page / $block_per_page); // 현재 페이지가 속해 있는 블록 번호

$start_record = ($page - 1) * $maximum; // 현재 레코드 가져올 것

$start_page = ($now_block - 1) * $block_per_page + 1; // 현재 페이지


mysql_query("ALTER TABLE 'mnormal_mode' ORDER BY 'Time' DESC "); // 최근 시간을 가져오기 위해

if( $find && $str ){

$sql = mysql_query("select * from mnormal_mode where $find like '%$str%' group by IP order by IP LIMIT $start_record,$maximum");

echo "<script>window.scrollTo(0,500);</script>";

}else{

$sql = mysql_query("select * from mnormal_mode group by IP order by IP LIMIT $start_record,$maximum");

}

?>

<body>

<center>

<table width="430px">

<tr>

<td colspan=6><div align="right">전체 : <?=$total_num?> 건

<form name="line" style="display:inline; margin:auto;">

<select name="maximum" onchange="java_list_change(this.value,'<?=$find?>','<?=$str?>')">

<?

if($maximum == 5){

?><option value=5 selected=selected>5줄</option><?

}else{

?><option value=5>5줄</option><?

}

if($maximum == 10){

?><option value=10 selected=selected>10줄</option><?

}else{

?><option value=10>10줄</option><?

}

if($maximum == 20){

?><option value=20 selected=selected>20줄</option><?

}else{

?><option value=20>20줄</option><?

}

if($maximum == 30){

?><option value=30 selected=selected>30줄</option><?

}else{

?><option value=30>30줄</option><?

}

if($maximum == 50){

?><option value=50 selected=selected>50줄</option><?

}else{

?><option value=50>50줄</option><?

}

if($maximum == 100){

?><option value=100 selected=selected>100줄</option><?

}else{

?><option value=100>100줄</option><?

}

?>

</select>

</form>

</div></td>

</tr>

<tr class="title_">

<td width="30px" style="padding:0px; text-align:center;">Num</td>

<td width="80px" style="padding:0px; text-align:center;">IP</td>

<td width="80px" style="padding:0px; text-align:center;">Java</td>

<td width="60px" style="padding:0px; text-align:center;">Check</td>

<td width="80px" style="padding:0px; text-align:center;">All_Check</td>

<td width="90px" style="padding:0px; text-align:center;">점검 시간</td>

</tr>


<?

for($i=$start_record ; $i<$start_record+$maximum ; $i++){

$row = mysql_fetch_array($sql);

if($i % 2 == 0){

?>

<tr class="res1">

<?

}else if($i % 2 == 1){

?>

<tr class="res2">

<?

}

?>

<td style="padding:0px; text-align:center;"><?=$i+1?></td>

<td style="padding:0px; text-align:center;"><?=$row['IP']?></td>

<td style="padding:0px; text-align:center;"><?=$row['Java']?></td>

<?

if($row['Java_Safe'] == "취약"){

?>

<td style="padding:0px; text-align:center;"><font color="red"><?=$row['Java_Safe']?></font></td>

<?

}else if($row['Java_Safe'] == "안전"){

?>

<td style="padding:0px; text-align:center;"><font color="#00B700"><?=$row['Java_Safe']?></font></td>

<?

}else{

?>

<td style="padding:0px; text-align:center;"><font color="#BDBDBD"><?=$row['Java_Safe']?></font></td>

<?

}

?>


<?

if($row['All_Check'] == "취약"){

?>

<td style="padding:0px; text-align:center;"><font color="red"><?=$row['All_Check']?></font></td>

<?

}else if($row['All_Check'] == "안전"){

?>

<td style="padding:0px; text-align:center;"><font color="#00B700"><?=$row['All_Check']?></font></td>

<?

}else{

?>

<td style="padding:0px; text-align:center;"><font color="#00B700"><?=$row['All_Check']?></font></td>

<?

}

?>

<?

$time = substr($row['Time'],"0","10");

?>

<td style="padding:0px; text-align:center;"><?=$time?></td>

</tr>

<?

}

?>


<tr>

<td colspan=2>


<?

$end_page = ( ($start_page+$block_per_page) <= $total_page) ? ($start_page+$block_per_page) : $total_page;

if($now_block > 1){

?>

<a href="#" onclick="java_page_change('<?=$start_page-$block_per_page?>','<?=$find?>','<?=$str?>',document.line.maximum.value);" style="text-decoration:none;"><font color="blue"><b>◀</b></font></a>

<?

}

for($i=$start_page; $i<$end_page ; $i++){

if($page == $i){

?>

<font color="blue"><b><?=$i?></b></font>

<?

}else{

?>

<a href="#" onclick="java_page_change('<?=$i?>','<?=$find?>','<?=$str?>',document.line.maximum.value);"><font color="blue"><b><?=$i?></b></font></a>

<?

}

}

if( $now_block == $total_block ) { //남은 블록이 2블록 이상인 경우 마지막으로 링크 출력; 

?>

<a href="#" onclick="java_page_change('<?=$end_page?>','<?=$find?>','<?=$str?>',document.line.maximum.value);"><font color="blue"><b><?=$i?></b></font></a>

<?

}

if($now_block < $total_block){

?>

<a href="#" onclick="java_page_change('<?=$start_page+$block_per_page?>','<?=$find?>','<?=$str?>',document.line.maximum.value);" style="text-decoration:none;"><font color="blue"><b>▶</b></font></a>

<?

}

?>


</td>

<td colspan=4 align="right">

<form name="java_search" action="#" method="post" style="display:inline;" onkeypress="return event.keyCode!=13">

<select name="search_what">

<option selected=selected>선택</option>

<option value=IP>IP</option>

<option value=Java>Java</option>

<option value=Java_Safe>Check</option>

<option value=All_Check>All_Check</option>

</select>

<input type="text" name="search_str" onkeydown="java_EnterKey(this.form);" ><input type="button" value="검색" onclick="java_search_change(this.form);">

</form>

</td>

</tr>

</table>

</center>

</body>

</html>


<script>

function java_page_change(num,find,str,max){

var oDate = new Date();

str = encodeURI(str);

$(function () {

$(document).ready(function() {

$("#web_java_result").load("./web_java_result.php?t="+oDate.getTime()+"&page="+num+"&what="+find+"&str="+str+"&maximum="+max);

});    

});

}


function java_list_change(num,find,str){

var oDate = new Date();

str = encodeURI(str);

$(function () {

$(document).ready(function() {

$("#web_java_result").load("./web_java_result.php?t="+oDate.getTime()+"&maximum="+num+"&what="+find+"&str="+str);

});    

});

}


function java_search_change(form){

var what = form.search_what.value;

var str  = form.search_str.value;

var oDate = new Date();

str = encodeURI(str);

if(what == ""){

alert("검색할 목록을 선택해 주세요");

form.search_what.focus();

return;

}

if(str == ""){

alert("검색할 문장을 입력 주세요");

form.search_str.focus();

return;

}

$(function () {

$(document).ready(function() {

$("#web_java_result").load("./web_java_result.php?t="+oDate.getTime()+"&what="+what+"&str="+str);

});    

});

}


function java_EnterKey(form){

var oDate = new Date();

if (event.keyCode == 13) {

var what = form.search_what.value;

var str  = form.search_str.value;

str = encodeURI(str);

if(what == ""){

alert("검색할 목록을 선택해 주세요");

form.search_what.focus();

return;

}

if(str == ""){

alert("검색할 문장을 입력 주세요");

form.search_str.focus();

return;

}

$(function () {

$(document).ready(function() {

$("#web_java_result").load("./web_java_result.php?t="+oDate.getTime()+"&what="+what+"&str="+str);

});    

});

}

}

</script>



참조 페이지 : http://sexy.pe.kr/tc/30