<?PHP
include("index.cma.db.php");
date_default_timezone_set('ASIA/JAKARTA');
$tablename3 = "tab_polisi";
$next_increment     = 0;
$qShowStatus        = "SHOW TABLE STATUS LIKE '$tablename3'";
$qShowStatusResult  = mysql_query($qShowStatus) or die ( "Query failed: " . mysql_error() . "<br/>" . $qShowStatus );
$row = mysql_fetch_assoc($qShowStatusResult);
$next_increment = $row['Auto_increment'];
$query = "Select * from $mytable"; 
$result = mysql_query($query); 
if($row = mysql_fetch_array($result)){
?>
<LINK href="index.css" rel="stylesheet" type="text/css">
<title>CAMELON INSTALLATION</title><table width="100%"  border="0" cellspacing="8" cellpadding="8">
  <tr>
    <td bgcolor="#FF9900"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
      <tr>
        <td><strong>SELAMAT DATANG DI CAMELON INSTALASI </strong></td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="4" cellpadding="4">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="4" cellpadding="4" class="panel">
  <tr>
    <td colspan="2">Input Daftar Kepolisian (Polres &amp; Polsek) </td>
  </tr>
  <tr>
    <td colspan="2">Gunakan Huruf Kapital/Besar </td>
  </tr>
  <tr>
    <td width="54%" valign="top"><form action="install.2.php" method="post" name="form2" id="form2">
        <table width="100%"  border="0" cellspacing="4" cellpadding="4">
          <tr>
            <td width="24%">Instansi</td>
            <td width="3%">:</td>
            <td><input name="instansi" type="text" id="instansi" size="30">              </td>
          </tr>
          <tr>
            <td width="24%">&nbsp;</td>
            <td width="3%">&nbsp;</td>
            <td>Contoh : POLSEK XXX / POLRES XXX
              <input name="key" type="hidden" id="key" value="polisi">
              <input name="table" type="hidden" id="table" value="tab_polisi"> 
              &amp; Gunakan Huruf Kapital </td>
          </tr>
          <tr>
            <td>Nomor Urut </td>
            <td>:</td>
            <td><input name="nourut" type="text" id="nourut" value="<?PHP echo $next_increment; ?>" size="2" readonly="1">            </td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>(tidak diperbolehkan duplikasi nomor urut) (tidak boleh untuk di edit) </td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit2" value="Simpan"></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
    </form><? } ?> </td>
    <td width="46%" valign="top" bgcolor="#FFFFCC"><table width="100%"  border="0" cellspacing="8" cellpadding="8">
      <tr>
        <td><span class="tabContents">
          <?

mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$mytable = "tab_polisi";
if(empty($action))
{
if (empty($order)) $order =  2;
if (empty($page2))  $page2  =  1;
if (empty($hits))  $hits  = 100;
$start = $hits*($page2-1);
$query = "SELECT * FROM $mytable ORDER BY p_id DESC";
$res = mysql_query("$query"); 
$xnum = mysql_num_rows($res);
$stw2 = (int)($xnum/$hits);
if ($xnum%$hits > 0) {$stw2++;}
$np = $page2+1;
$pp = $page2-1;
if ($page2 == 1) { $pp=1; }
if ($np > $stw2) { $np = $stw2;} 
echo "DAFTAR KEPOLISIAN <strong>$xnum</strong>";
//for ($i=1;$i<=$stw2;$i++) {if($page2==$i){
//echo "<b> HAL $i |</b> ";} 
//else{echo "<a href=\"?g=pratut&i=index&page2=$i#tab1\"> $i |</a>";}}
print ('<br><br>');
$query  = "SELECT * FROM $mytable ";
if(!empty($squery)) { $query .= "LIKE \"%$squery%\" ";}
$query .= "ORDER BY p_id DESC LIMIT $start,$hits";
$res = mysql_query($query);
print ('<table class="tableWithFloatingHeader" width="100%"  border="0" cellspacing="1" cellpadding="1" bgcolor="#B05800">
        <thead><tr>
<th width="90%"><strong>UNIT</strong></th>
<th width="10%"><strong>NO</strong></th>

</tr></thead>');
 $x=0;
  while($row = mysql_fetch_array($res))
  {
   $x++;
   if($x==2) {$barva = "FF6600";$x=0;} else {$barva = "FFFFCC";$x=1;}
   
//---------kolom 1
print ('<tbody><tr bgcolor=#'.$barva.'>');
print ('<td><b>'.$row['p_nama'] .'</b></td>');
print ('<td><center><b>'.$row['p_nomor'] .'</b></center></td>');

print ('</tr>');} 
print ('</tbody> </table>');
}
?>
        </span></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="2"><span class="tabContents">
    </span></td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="8" cellpadding="8">
  <tr>
    <td width="88%"><strong>JIKA SUDAH SELESAI MEMASUKKAN SEMUA INSTANSI KEPOLISIAN SILAHKAN KLIK NEXT </strong></td>
    <td width="12%"><a href="index.3.php" class="menu">NEXT</a></td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="8" cellpadding="8">
  <tr>
    <td><div align="center"></div></td>
  </tr>
  <tr>
    <td><div align="center">Camelon By <strong>Chendia Studio Network </strong></div></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>

