<?
// 기본 설정 로딩
require_once('config.php');
require_once('function.php');
require_once('lib.php');

//HTML 시작
echo "
<style>
input[type=text] {padding:2px; border:1px solid #ccc;-webkit-border-radius: 5px;border-radius: 5px;}
input[type=text]:focus {border-color:#333; }
</style>
";

 function MKRAND() { 
    $array = array_merge(range('A', 'Z'), range('z', 'a'), range(1, 9)); 
    for($i=0; $i<8; $i++) {  
       $rand .= $array[mt_rand(0,count($array)-1)];  
    }  
    return $rand; 
 }  
 $mkrand = MKRAND(); 
 
echo "<strong>패스워드용 난수 : </strong><input type=text style='width:290px;' value='$mkrand'><br><br>";
if (!$_GET[limit]){$limit=5;} else {$limit=$_GET[limit];}

//$limit=$limit-1;
//$query="select * from historydb order by history_num desc limit 0,$limit";
$query = "SELECT c.Client_Code,c.Client_Name,s.server_code,h.note,h.behavior
	FROM servicedb AS s 
	JOIN historydb AS h ON s.service_code = h.service_code
	JOIN clientdb AS c ON s.client_code = c.Client_Code
	ORDER BY history_num DESC LIMIT 0,$limit";
$result = @mysql_query($query , $db_connect) or die($db_q_error);
while ($row = mysql_fetch_assoc($result)) {
?>
<i class="fa fa-info-circle fa-fw"></i><a href="/serviceDetailSolo.sev?client_code=<?=$row[Client_Code]?>&service_code=<?=$row[service_code]?>" style="text-decoration: none;color:gray;font-size:10pt;line-height:1.6em;">[ <?=$row[Client_Name]?> ] <?=$row[server_code]?> / <?=$row[behavior]?></a><span class="pull-right text-muted small"><em><?=$row[note]?></em></span><br>
<?
}
//DB닫기
mysql_close($db_connect);
?>
