<?PHP
include("index.cma.db.php");
$query = "Select * from $mytable"; 
$result = mysql_query($query); 
if($row = mysql_fetch_array($result)){
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>CAMELON | CASE MANAGEMENT APPLICATION | KEJAKSAAN NEGERI <?PHP echo htmlspecialchars($row['s_satker']); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK href="images/index.css" rel="stylesheet" type="text/css">
<link href="images/keyboardstyle.css" type="text/css" rel="stylesheet" />

<style type="text/css">
<!--
body {
	background-image: url(images/green_wallpaper.jpg);
	margin-top: 0px;
	margin-left: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
.style2 {color: #FFFFFF}
.style3 {	color: #FFFFFF;
	font-weight: bold;
}
.style3 {	color: #FFFFFF;
	font-weight: bold;
}
-->
</style><style type="text/css" media="all">
@import "style.css";
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
</style>
<script type="text/javascript">
var message="Sorry, right-click has been disabled";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
</script> </head>

<body>
<table width="100%"  border="0" cellspacing="8" cellpadding="8">
  <tr>
    <td><div align="left">
        <?php
mysql_connect("localhost", "root", "benk")or die("Error connecting to database: ".mysql_error());
mysql_select_db("cma_tilang")or die(mysql_error());
    $query = $_POST['queryd'];
	$table = $_POST['table'];
    $min_length = 3;
    if(strlen($query) >= $min_length){
        $query = htmlspecialchars($query);
        $query = mysql_real_escape_string($query);
        $raw_results = mysql_query("SELECT * FROM $table WHERE 
		(`t_nomor` LIKE '%".$query."%') OR (`t_nama` LIKE '%".$query."%')") or die(mysql_error());
		
		
		
	
        if(mysql_num_rows($raw_results) > 0){ // if one or more rows are returned do following
             print ('<table width="100%"  border="0" cellspacing="2" cellpadding="2">
  <tr bgcolor="#FF9900">
    <td width="10%"><span class="style1"><strong>NO TILANG</strong></span></td>
<td width="25%"><span class="style1"><strong>NAMA</strong></span></td>
<td width="55%"><span class="style1"><strong>DENDA</strong></span></td>
<td width="10%"><span class="style1"><strong>PASAL</strong></span></td>
  </tr>');
            while($results = mysql_fetch_array($raw_results)){
	  print ('
     <tr bgcolor="#FFF1BB">
    <td>'.$results['t_nomor'].'</td>
    <td><b>'.$results['t_nama'].'</b><br>'.$results['t_alamat'].'</td>
	<td>'.$results['t_denda'].'+ Biaya Perkara '.$results['t_biayaperkara'].' (silahkan dibayar Nilai Denda ditambah Biaya perkara tersebut ke Bank BRI (teller) Hubungi Kejaksaan Negeri Setempat untuk Informasi lebih lanjut Catat Nomor Briva Anda '.$results['t_nomorbriva'].'</td>
	<td>'.$results['t_pasal'].'</td>'
	);
print ('</tr>');
            }
             print ('</table>');
        }
        else{ 
            echo "Tidak ditemukan Nama Terdakwa dan Nomor Tilang";
        }
         
    }
    else{ // if query length is less than minimum
        echo "Minimum length is ".$min_length;
    }
?>
    </div></td>
  </tr>
  <tr>
    <td>DENDA TILANG DAPAT DIBAYAR DAN BARANG BUKTI DAPAT DIAMBIL DI KANTOR KEJAKSAAN SETIAP HARI PADA JAM KERJA </td>
  </tr>
</table>
</body>
</html>
<? } ?>
