<?PHP include("index.globalconfig.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?PHP echo $satker; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK href="images/index.css" rel="stylesheet" type="text/css">

<script language="javascript" type="text/javascript">
<!--
/****************************************************
     Author: Eric King
     Url: http://redrival.com/eak/index.shtml
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);}
// -->
</script>
  <script type="text/javascript">
      function updateText()
    {	
    var dd = document.getElementById("jaksa1");
    var ddtext = dd.options[dd.selectedIndex].text;
    var sp_ddtext = ddtext.replace(/[^. a-zA-Z]+/g,'');
    document.getElementById("jaksa").value = sp_ddtext;
    }
    </script>
<style type="text/css">
<!--
body {
	background-image: url();
	margin-top: 0px;
	background-color: #CC3300;
	margin-bottom: 0px;
	margin-left: 0px;
	margin-right: 0px;
}
-->
</style> <link rel="stylesheet" href="images/date_css.css" />
<script src="images/date_javascript.js"></script>
<script src="images/date_jquery.js"></script>
 <script>
$(function() {
$( "#datepicker" ).datepicker();
$( "#datepicker2" ).datepicker();
});
</script>
<SCRIPT TYPE="text/javascript">
<!--
// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
key = window.event.keyCode;
else if (e)
key = e.which;
else
return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) ||
(key==9) || (key==13) || (key==27) )
return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
return true;

// decimal point jump
else if (dec && (keychar == "."))
{
myfield.form.elements[dec].focus();
return false;
}
else
return false;
}

//-->
</SCRIPT>
</head>

<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="bottom" bgcolor="#FF0000">&nbsp;</td>
  </tr>
  <tr>
    <td><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="78%" valign="top" bgcolor="#CCCCCC"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td bgcolor="#CCCCCC"><table width="100%"  border="0" cellspacing="4" cellpadding="4">
                <tr>
                  <td><strong>SISTEM PENGELOLAAN BARANG BUKTI <?PHP echo "$satker"; ?></strong></td>
                </tr>
              </table></td>
            </tr>
          </table>
          </td>
      </tr>
    </table>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td bgcolor="#FFFFFF"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="1">
            <tr>
              <td width="85%" valign="top"><script type="text/javascript">

/*
Form field Limiter script- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}


function displaylimit(thename, theid, thelimit){
var theform=theid!=""? document.getElementById(theid) : thename
var limit_text='<b><span id="'+theform.toString()+'">'+thelimit+'</span></b> Batasan karakter'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}

          </script>
              </td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td><table width="100%"  border="0" cellspacing="4" cellpadding="4">
                  <tr>
                    <td bgcolor="#ECECEC"><table width="100%"  border="0" cellspacing="6" cellpadding="6">
                        <tr>
                          <td><form action="index.barbuk.cari.php" method="post" enctype="multipart/form-data" name="form1">
                            <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td bgcolor="#FFCCFF"><table width="100%"  border="0" cellspacing="8" cellpadding="8">
                                    <tr>
                                      <td width="21%">Masukan Nama UKEY atau SCAN Barcode </td>
                                      <td width="79%"><input name="query" type="text" id="query2" size="40">                                        <input type="submit" name="Submit" value="Cari"></td>
                                      </tr>
                                </table></td>
                              </tr>
                            </table>
                          </form>
                 <?php
				   include("barbuk/index.db.php");
				   
mysql_connect("$server", "$username", "$password") or die("Error connecting to database: ".mysql_error());
mysql_select_db("$database") or die(mysql_error());
?>

        <?php
			

    $query = $_GET['query'];
	$query = $_POST['query'];
	
    $min_length = 3;
    if(strlen($query) >= $min_length){
        $query = htmlspecialchars($query);
        $query = mysql_real_escape_string($query);
        $raw_results = mysql_query("SELECT * FROM $tahun_now WHERE (`UKEY` LIKE '%".$query."%') OR (`TERDAKWA` 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="3%"><span class="style1"><strong>NO</strong></span></td>
<td width="7%"><span class="style1"><strong>UKEY</strong></span></td>
<td width="15%"><span class="style1"><strong>NAMA TERDAKWA</strong></span></td>
<td width="20%"><span class="style1"><strong>NOMOR REG. BARANG BUKTI</strong></span></td>
<td width="55%"><span class="style1"><strong>NAMA BARANG</strong></span></td>

  </tr>');
  $no=1; // fungsi nomor
 $x=0;
            while($row = mysql_fetch_array($raw_results)){
             
      $x++;
   if($x==2) {$barva = "FFFFB7";$x=0;} else {$barva = "FFD8B0";$x=1;}
	  print ('<tr bgcolor=#'.$barva.'><td><center>'.$no++.'<center></td>');
	  print ('<td>'.$row['UKEY'] .'</td>');
print ('<td>'.$row['TERDAKWA'] .'</td>');
print ('<td>'.$row['RB'] .'</td>');
print ('<td>'.$row['NAMABARANG'] .'</td>');

print ('</tr>');
            }
             print ('</table>');
        }
        else{ 
            echo "<br><br><center>Tidak ditemukan Nama Terdakwa maupun UKEY  $query dalam database</center>";
        }
         
    }
    else{ // if query length is less than minimum
        echo "Minimum length is ".$min_length;
    }
?></td>
                        </tr>
                    </table></td>
                  </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
