<?PHP
include("../index.cma.db.php");
include("../index.globalconfig.php");
$query = "Select * from $mytable"; 
$result = mysql_query($query); 
if($row = mysql_fetch_array($result)){
$query = "Select * from tab_surat where s_id = '1'"; 
$result = mysql_query($query); 
if($row2 = mysql_fetch_array($result)){ 
$tabler = $row2['s_nama'];
?>
<!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">
<link href="images/menu.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	background-image: url();
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #ECECEC;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
 <link rel="stylesheet" href="images/jquery-ui.css">
  <script src="images/jquery-1.12.4.js"></script>
  <script src="images/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#datepicker" ).datepicker();
	dateFormat:"%d/%m/%Y"
  } );
  </script>
<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 printF(printData)
{
var a = window.open ('', '',"status=1,scrollbars=1, width=900,height=600");
a.document.write(document.getElementById(printData).innerHTML.replace(/<a\/?[^>]+>/gi, ''));
a.document.close();
a.focus();
a.print();
a.close();
}
</script>
</head>

<body>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td bgcolor="#F1F1F1"><table width="100%"  border="0" cellspacing="8" cellpadding="8">
              <tr>
                <td> if it's empty you don't have the latest letter </td>
              </tr>
              <tr>
                <td><table width="100%"  border="0" cellspacing="4" cellpadding="4" class="panel">
  <tr>
    <td><table width="100%"  border="0" cellspacing="6" cellpadding="6">
        <tr>
          <td><strong>Welcome </strong></td>
        </tr>
        <tr>
          <td><?php
$query = "Select * from tab_surat where s_id = '1'"; 
$result = mysql_query($query); 
if($row = mysql_fetch_array($result)){ 
$mytable1 = $row['s_nama'];
$mytabler1 = $mytable1.'1';
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result1 = mysql_query("SELECT * FROM $mytabler1 where tu_disposisi =''", $link);
$num_rows = mysql_num_rows($result1);
if ($num_rows == "0") {print ('');} 
elseif ($num_rows !== "0") {
print ('<a href="../tatapersuratan/ago/index.php"  class="menu" target="_parent">You have '.$num_rows.' new letter for disposition <strong>[ SURAT BIASA ] Check now</strong></a><br>');

}
//--------------
$mytabler2 = $mytable1.'2';
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result2 = mysql_query("SELECT * FROM $mytabler2 where tu_disposisi =''", $link);
$num_rows2 = mysql_num_rows($result2);
if ($num_rows2 == "0") {print ('');} 
elseif ($num_rows2 !== "0") {
print ('<a href="../tatapersuratan/ago/index.php"  class="menu" target="_parent">You have '.$num_rows2.' new letter for disposition <strong>[ KEPUTUSAN ]</strong><strong>Check now</strong></a><br>');
}
//-------end
//--------------
$mytabler3 = $mytable1.'3';
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result3 = mysql_query("SELECT * FROM $mytabler3 where tu_disposisi =''", $link);
$num_rows3 = mysql_num_rows($result3);
if ($num_rows3 == "0") {print ('');} 
elseif ($num_rows3 !== "0") {
print ('<a href="../tatapersuratan/ago/index.php"  class="menu" target="_parent">You have '.$num_rows3.' new letter for disposition <strong>[ SPDP ] Check now</strong></a><br>');
}
//-------end
//--------------
$mytabler4 = $mytable1.'4';
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result4 = mysql_query("SELECT * FROM $mytabler4 where tu_disposisi =''", $link);
$num_rows4 = mysql_num_rows($result4);
if ($num_rows4 == "0") {print ('');} 
elseif ($num_rows4 !== "0") {
print ('<a href="../tatapersuratan/ago/index.php"  class="menu" target="_parent">You have '.$num_rows4.' new letter for disposition <strong>[ NODIS ] Check now</strong></a><br>');
}
//-------end
//--------------
$mytabler5 = $mytable1.'5';
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result5 = mysql_query("SELECT * FROM $mytabler5 where tu_disposisi =''", $link);
$num_rows5 = mysql_num_rows($result5);
if ($num_rows5 == "0") {print ('');} 
elseif ($num_rows5 !== "0") {
print ('<a href="../tatapersuratan/ago/index.php"  class="menu" target="_parent">You have '.$num_rows5.' new letter for disposition <strong>[ KEPUTUSAN ] Check now</strong></a><br>');
}
//-------end
//--------------
$mytabler6 = $mytable1.'6';
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result6 = mysql_query("SELECT * FROM $mytabler6 where tu_disposisi =''", $link);
$num_rows6 = mysql_num_rows($result6);
if ($num_rows6 == "0") {print ('');} 
elseif ($num_rows6 !== "0") {
print ('<a href="../tatapersuratan/ago/index.php"  class="menu" target="_parent">You have '.$num_rows6.' new letter for disposition <strong>[ SPRINT ] Check now</strong></a><br>');
}
//-------end
//--------------
$mytabler7 = $mytable1.'7';
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result7 = mysql_query("SELECT * FROM $mytabler7 where tu_disposisi =''", $link);
$num_rows7 = mysql_num_rows($result7);
if ($num_rows7 == "0") {print ('');} 
elseif ($num_rows7 !== "0") {
print ('<a href="../tatapersuratan/ago/index.php"  class="menu" target="_parent">You have '.$num_rows7.' new letter for disposition <strong>[ PENGANTAR ] Check now</strong></a><br>');
}
//-------end
//--------------
$mytabler8 = $mytable1.'8';
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result8 = mysql_query("SELECT * FROM $mytabler8 where tu_disposisi =''", $link);
$num_rows8 = mysql_num_rows($result8);
if ($num_rows8 == "0") {print ('');} 
elseif ($num_rows8 !== "0") {
print ('<a href="../tatapersuratan/ago/index.php"  class="menu" target="_parent">You have '.$num_rows8.' new letter for disposition <strong>[ RAHASIA ] Check now</strong></a><br>');
}
//-------end
//--------------
$mytabler9 = $mytable1.'9';
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result9 = mysql_query("SELECT * FROM $mytabler9 where tu_disposisi =''", $link);
$num_rows9 = mysql_num_rows($result9);
if ($num_rows9 == "0") {print ('');} 
elseif ($num_rows9 !== "0") {
print ('<a href="../tatapersuratan/ago/index.php" class="menu" target="_parent">You have '.$num_rows9.' new letter for disposition <strong>[ UNDANGAN ] Check now</strong></a><br>');
}
//-------end
}
?></td>
        </tr>
    </table></td>
  </tr>
</table>
</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
<? }} ?>
