  <?PHP 
  include("../index.cma.db.php");
  include("../index.globalconfig.php");
	 mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$query = "Select * from tab_surat where s_id = '1'"; 
$result = mysql_query($query); 
if($row = mysql_fetch_array($result)){ 
$db = $row['s_nama'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>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/menu.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	background-image: url(images/index.jpg);
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
<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">
<!--
// 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" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="#669900"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="700" height="50">
        <param name="movie" value="../themes/top_hijau.swf">
        <param name="quality" value="high">
        <embed src="../themes/top_hijau.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="700" height="50"></embed>
    </object></td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td bgcolor="#004000"><table width="100%"  border="0" cellspacing="6" cellpadding="6">
          <tr>
            <td><span class="style1">SELAMAT DATANG OPERATOR TATA USAHA </span></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><div class="drop">
                <ul class="drop_menu">
                  <li><a href='index.php'><strong>HOME</strong></a>
                      <ul>
                        <li><a href='index.php?g=beranda&i=index'>BERANDA & NOTIFIKASI</a></li>
						<li><a href='index.pencarian.php'>PENCARIAN SURAT</a></li>
                        <li><a href='../admin/index.keychange.php?user=<?PHP echo $Nama; ?>' onclick="NewWindow(this.href,'mywin','600','300','yes','center');return false" onfocus="this.blur()">UBAH PASSWORD</a></li>
                      </ul>
                  </li>
                  <li><a href='index.php'><strong>SURAT KELUAR</strong></a>
                      <ul>
                        <li><a href="index.php?g=postingsuratkeluar&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=b" title="KELUAR BIASA">1. SURAT KELUAR BIASA</a></li>
                        <li><a href="index.php?g=postingsuratkeluar&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=r" title="RAHASIA">2. SURAT KELUAR RAHASIA</a></li>
                        <li><a href="index.php?g=postingsuratkeluar&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=sp" title="SPRINT">3. SURAT PERINTAH</a></li>
                        <li><a href="index.php?g=postingsuratkeluar&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=sk" title="SK">4. SURAT KEPUTUSAN</a></li>
                        <li><a href="index.phpindex.dropfile.php?dir=<? echo "$tabler"; ?>" title="Home" target="_blank">DROP FIlE SCAN SURAT KELUAR</a></li>
                      </ul>
                  </li>
                  <li><a href='#'><strong>REKAP SURAT KELUAR</strong></a>
                      <ul>
                        <li><a href="index.php?g=viewsuratallkeluar&i=index&jenis=b&filter=1" title="SB-">1. SURAT BIASA</a></li>
                        <li><a href="index.php?g=viewsuratallkeluar&i=index&jenis=b&filter=2" title="SD-">2. SURAT DALAM</a></li>
                        <li><a href="index.php?g=viewsuratallkeluar&i=index&jenis=r&filter=0" title="R-">3. RAHASIA</a></li>
                        <li><a href="index.php?g=viewsuratallkeluar&i=index&jenis=sp&filter=0" title="SP-">4. SURAT PERINTAH</a></li>
                        <li><a href="index.php?g=viewsuratallkeluar&i=index&jenis=sk&filter=0" title="SK-">5. SURAT KEPUTUSAN</a></li>
                      </ul>
                  </li>
                  <li><a href='#'><strong>INPUT SURAT MASUK</strong></a>
                      <ul>
                        <li><a href="index.php?g=berkastahap1&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=1" title="HOME">BERKAS TAHAP 1</a></li>
                        <li><a href="index.php?g=postingsurat&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=1" title="HOME">1. SURAT BIASA</a></li>
                        <li><a href="index.php?g=postingsurat&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=2" title="HOME">2. SURAT DALAM</a></li>
                        <li><a href="index.php?g=postingspdp&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=3" title="HOME">3. SPDP</a></li>
                        <li><a href="index.php?g=postingsurat&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=4" title="HOME">4. NOTA DINAS</a></li>
                        <li><a href="index.php?g=postingsurat&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=5" title="HOME">5. KEPUTUSAN</a></li>
                        <li><a href="index.php?g=postingsurat&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=6" title="HOME">6. SURAT PERINTAH</a></li>
                        <li><a href="index.php?g=postingsurat&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=7" title="HOME">7. PENGANTAR</a></li>
                        <li><a href="index.php?g=postingsurat&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=8" title="HOME">8. RAHASIA</a></li>
                        <li><a href="index.php?g=postingsurat&i=index&day=<? echo $date = date("d");?>&month=<? echo $date = date("m");?>&year=<? echo $date = date("Y");?>&table=<? echo "$tabler"; ?>&jenis=9" title="HOME">9. UNDANGAN</a></li>
                      </ul>
                  </li>
                  <li><a href='#'><strong>UPDATE DISPOSISI SURAT MASUK</strong></a>
                      <ul>
                        <li><a href="index.php?g=viewsurat&i=index&jenis=1" title="HOME">1. SURAT BIASA</a></li>
                        <li><a href="index.php?g=viewsurat&i=index&jenis=2" title="HOME">2. SURAT DALAM</a></li>
                        <li><a href="index.php?g=viewsurat&i=index&jenis=3" title="HOME">3. SPDP</a></li>
                        <li><a href="index.php?g=viewsurat&i=index&jenis=4" title="HOME">4. NOTA DINAS</a></li>
                        <li><a href="index.php?g=viewsurat&i=index&jenis=5" title="HOME">5. KEPUTUSAN</a></li>
                        <li><a href="index.php?g=viewsurat&i=index&jenis=6" title="HOME">6. SURAT PERINTAH</a></li>
                        <li><a href="index.php?g=viewsurat&i=index&jenis=7" title="HOME">7. PENGANTAR</a></li>
                        <li><a href="index.php?g=viewsurat&i=index&jenis=8" title="HOME">8. RAHASIA</a></li>
                        <li><a href="index.php?g=viewsurat&i=index&jenis=9" title="HOME">9. UNDANGAN</a></li>
                      </ul>
                  </li>
                  <li><a href='#'><strong>REKAP SURAT MASUK</strong></a>
                      <ul>
                        <li><a href="index.php?g=viewsuratall&i=index&jenis=1" title="HOME">1. SURAT BIASA</a></li>
                        <li><a href="index.php?g=viewsuratall&i=index&jenis=2" title="HOME">2. SURAT DALAM</a></li>
                        <li><a href="index.php?g=viewsuratall&i=index&jenis=3" title="HOME">3. SPDP</a></li>
                        <li><a href="index.php?g=viewsuratall&i=index&jenis=4" title="HOME">4. NOTA DINAS</a></li>
                        <li><a href="index.php?g=viewsuratall&i=index&jenis=5" title="HOME">5. KEPUTUSAN</a></li>
                        <li><a href="index.php?g=viewsuratall&i=index&jenis=6" title="HOME">6. SURAT PERINTAH</a></li>
                        <li><a href="index.php?g=viewsuratall&i=index&jenis=7" title="HOME">7. PENGANTAR</a></li>
                        <li><a href="index.php?g=viewsuratall&i=index&jenis=8" title="HOME">8. RAHASIA</a></li>
                        <li><a href="index.php?g=viewsuratall&i=index&jenis=9" title="HOME">9. UNDANGAN</a></li>
                      </ul>
                  <li><a href='#'><strong>DATA DIGITAL</strong></a>
                      <ul>
                        <li><a href="index.phpindex.makedir.php?direktori=<? echo "$tabler"; ?>" title="Home">BUAT DIREKTORI</a></li>
                      </ul>
                  </li>
                  <li><a href='../index.logout.php'><strong>LOGOUT</strong></a> </li>
                </ul>
            </div></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td bgcolor="#F1F1F1"><table width="100%"  border="0" cellspacing="6" cellpadding="6">
              <tr>
                <td></td>
              </tr>
              <tr>
                <td><table width="100%"  border="0" cellspacing="4" cellpadding="4">
  <tr>
    <td width="100%"><form action="index.pencarian.php" method="get" enctype="multipart/form-data" name="form1">
        <table width="100%"  border="0" cellspacing="4" cellpadding="4">
          <tr>
            <td><div align="center">Cari Surat :
                  <input name="query" class="baca1" id="query" onFocus="if(this.value=='CARI SURAT') this.value='';" onBlur="if(this.value=='') this.value='CARI SURAT';" onKeyUp="showUser(this.value)" size="40" type="text" maxlength="255"/>              
                  Dalam Database :
                  <select name="db" id="db">
                          <option value=0 selected>- Pilih Tahun Surat -</option>
                          <?php
mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$sql=mysql_query("select * from tab_surat");
while ($data=mysql_fetch_array($sql)){
print('<option value="'.$data["s_nama"].'">'.$data["s_tahun"].'</option>');
}
?>
                    </select>              
                  <select name="jenis" id="jenis">
                    <option value="0" selected>--Jenis Surat--</option>
                    <option value="1">Surat Masuk Biasa</option>
                    <option value="2">Surat Masuk Dalam</option>
                    <option value="3">Surat Masuk SPDP</option>
                    <option value="4">Surat Masuk Nota Dinas</option>
                    <option value="5">Surat Masuk Keputusan</option>
                    <option value="6">Surat Masuk Perintah</option>
                    <option value="7">Surat Masuk Pengantar</option>
                    <option value="8">Surat Masuk Rahasia</option>
                    <option value="9">Surat Masuk Undangan</option>
                    <option value="b">Surat Keluar Biasa</option>
                    <option value="r">Surat Keluar Rahasia</option>
                    <option value="sp">Surat Keluar Perintah</option>
                    <option value="sk">Surat Keluar Keputusan</option>
                        </select>
                  <input type="submit" name="Submit" value="Search">              
                </div></td>
            </tr>
        </table>
      </form>
                 </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><?php
mysql_connect("$server", "$username", "$password") or die("Error connecting to database: ".mysql_error());
mysql_select_db("$database") or die(mysql_error());
?>
      <?php
	  $dbs = $_GET['db'];
	$jenis = $_GET['jenis'];
	$db = $dbs."".$jenis;
    $query = $_GET['query'];

    $min_length = 3;
    if(strlen($query) >= $min_length){
        $query = htmlspecialchars($query);
        $query = mysql_real_escape_string($query);
        $raw_results = mysql_query("SELECT * FROM $db WHERE (`tu_perihal` LIKE '%".$query."%') OR (`tu_asalsrt` 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>N.A.</strong></span></td>
<td width="7%"><span class="style1"><strong>TGL SURAT</strong></span></td>
<td width="18%"><span class="style1"><strong>NO SURAT</strong></span></td>
<td width="17%"><span class="style1"><strong>ASAL SURAT</strong></span></td>
<td width="5%"><span class="style1"><strong>LAMP</strong></span></td>
<td width="30%"><span class="style1"><strong>PERIHAL / ISI SURAT</strong></span></td>
<td width="20%"><span class="style1"><strong>EKPEDISI</strong></span></td>
  </tr>');
            while($results = mysql_fetch_array($raw_results)){
             
    
	  print ('
  <tr bgcolor="#FFF1BB">');
  print ('<td>'.$results['tu_noagenda'].'</td>');
print ('<td>'.$results['tu_tglsrt'].'</td>');
print ('<td>'.$results['tu_nosrt'].'</td>');
print ('<td>'.$results['tu_asalsrt'].'</td>');
print ('<td>'.$results['tu_lamp'].'</td>');
print ('<td><a href="'.$db.'/'.$results['tu_noagenda'].'.pdf" target="_blank">'.$results['tu_perihal'].'</a></td>');
print ('<td><b>');
if ($results['tu_ekspedisi'] == "0") {echo "ERROR";} 
elseif ($results['tu_ekspedisi'] == "1") {echo "PEMBINAAN";} 
elseif ($results['tu_ekspedisi'] == "2") {echo "INTELIJEN";} 
elseif ($results['tu_ekspedisi'] == "3") {echo "PIDANA UMUM";} 
elseif ($results['tu_ekspedisi'] == "4") {echo "PIDANA KHUSUS";} 
elseif ($results['tu_ekspedisi'] == "5") {echo "DATUN";} 
elseif ($results['tu_ekspedisi'] == "6") {echo "KEUANGAN";} 
elseif ($results['tu_ekspedisi'] == "7") {echo "LAINNYA";} 
print (':</b><br>'.$results['tu_disposisi'].'</td>');
  print('</tr>');
            }
             print ('</table>');
        }
        else{ 
            echo "<center><b>Tidak ditemukan surat tersebut dalam database $db</b><center>";
        }
         
    }
    else{ // if query length is less than minimum
        echo "Panjang minimum pencarian 3 huruf".$min_length;
		
    }
?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="#999999"><table width="100%"  border="0" cellspacing="4" cellpadding="4">
      <tr>
        <td><strong><?php echo $satker; ?> | <?php echo $alamat; ?></strong></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
<? } ?>
