<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "form_login.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 
  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}
$MM_restrictGoTo = "form_login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Aplikasi Pembelajaran Bahasa Korea</title>
<link href="css/rinda_style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu.css" />
<style type="text/css">
<!--
.style1 {
	font-size: 24px;
	font-weight: bold;
}
.style3 {font-size: 14px}
.style4 {font-size: 14}
.style7 {color: #000000}
.style18 {font-family: Georgia, "Times New Roman", Times, serif}
.style22 {color: #FFFFFF;
	font-weight: bold;
	font-size: 24px;
	font-family: Georgia, "Times New Roman", Times, serif;
}
.style23 {color: #000000;
	font-size: 18px;
}
.style30 {font-weight: bold}
-->
</style>
</head>
<body>
<div id="desain_body_wrapper">
    <div id="desain_wrapper"><span id="desain_wrapper_top"></span>
      <div class="style1" id="desain_header">
        <div align="center">Aplikasi Pembelajaran Huruf Han-geul & Bahasa Korea Dasar</div>
        <div id="desain_menu" class="ddsmoothmenu">
          <ul>
		    <li><a href="index.php" >Home</a></li>
            <li><a href="input.php" >Input</a></li>
            <li><a href="lihat.php">Lihat</a>
            </li>
            <li><a href="cari.php">Cari </a>
            </li>
            <li><a href="<?php echo $logoutAction ?>" onclick="return confirm('Apakah Anda yakin?')">logout</a></li>
          </ul>
          <br style="clear: left" />
        </div>
      </div>
      <div id="desain_main">
        <p> </p>
        <form id="form1" name="form1" method="post" action="simpan.php">
          <?php
			if (!empty($_GET['message']) && $_GET['message'])
			?>
          </p>
          <div align="center" class="style30"></div>
          <table width="54%" border="0" align="center" cellpadding="4" cellspacing="2">
            <tr>
              <td colspan="3" bgcolor="#66CCFF"><div align="center">
                  <p class="style22 style23">INPUT KATA</p>
              </div></td>
            </tr>
            <tr>
              <td><span class="style18">Kata</span></td>
              <td><strong>:</strong></td>
              <td><label>
                <input name="kata" type="text" id="kata" required="required" />
              </label></td>
            </tr>
            <tr>
              <td valign="top" width="43%"><p class="style18">Arti</p></td>
              <td width="2%"><strong>:</strong></td>
              <td width="55%"><textarea name="arti" cols="47" rows="5" id="arti"></textarea></td>
            </tr>
            <tr>
              <td colspan="3" bgcolor="#66CCFF"><label>
                  <div align="right"><br />
                      <input type="submit" name="Submit" value="Simpan" />
                      <input type="reset" name="Submit2" value="Reset" />
                  </div>
                </label></td>
            </tr>
          </table>
        </form>
        <?php	
?>
</div>
  </div>
</div>
    <div id="desain_bottom">
      <div class="cleaner"></div>
    </div>
    
    <div id="desain_footer_wrapper">
        <div id="desain_footer">
            <div align="center">Designed by Rinda Lisna Wulandari </a>            </div>
        </div>
    </div>
</div>
</body>
</html>        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Aplikasi Pembelajaran Bahasa Korea</title>
<link href="css/faizal_style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style21 {font-weight: bold; font-size: 24px;}
.style23 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; }
.style12 {	font-family: Arial, Helvetica, sans-serif;
	color: #000000;
	font-size: 10;
}
.style13 {font-size: 12px}
.style17 {color: #FFFFFF}
.style18 {font-family: Arial, Helvetica, sans-serif; font-size: 10; font-weight: bold; color: #000000; }
.style19 {	color: #000000;
	font-size: 10px;
}
.style20 {font-size: 10}
.style22 {color: #000000; font-size: 10; }
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
  <label> </label>
  <div id="coba">
    </p>
    <p> </p>
  </div>
  <table width="64%" border="2" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="8%" bgcolor="#66CCFF"><div align="center">No</div></td>
      <td width="28%" bgcolor="#66CCFF"><div align="center">Kata </div></td>
      <td width="51%" bgcolor="#66CCFF"><div align="center">Arti</div></td>
      <td colspan="2" bgcolor="#66CCFF">Action</td>
    </tr>
    <?php
   include("conn.php");//koneksi kedatabase
   mysql_select_db("kamus2");//membuka database
   mysql_query ('SET NAMES utf8');
   $warnaGenap = "#C7FEFD";   // warna abu-abu
   $warnaGanjil = "#FFFFFF";  // warna putih
   $pilih_database=" SELECT *
FROM `kamus_id`
LIMIT 0 , 1000
";
$ambil=mysql_query($pilih_database);
   $no=1;
   $counter = 1;
   while($c=mysql_fetch_row($ambil)){
       if ($counter % 2 == 0) $warna = $warnaGenap;
              else $warna = $warnaGanjil;
			  ?>
    <tr bgcolor="<?=$warna?>">
      <td><div align="center"><span class="style20">
        <?=$no?>
      </span></div></td>
      <td><div align="center"><span class="style20">
        <?=$c[0]?>
      </span></div></td>
      <td><div align="center"><span class="style20">
        <?=$c[1]?>
      </span></div></td>
      <td width="7%" bgcolor="<?=$warna?>"><div align="center" id="coba"><a title="Edit Data" href="edit.php?kata=<?=$c[0]?>"><img src="images/edit.png" width="17" height="16" /></a> </div></td>
      <td width="6%"><div align="center"><a onclick="return confirm('Apakah Anda yakin?')" title="Apa anda yakin akan menghapus data" href="proseshapus.php?kata=<?=$c[0]?>"><img src="images/hapus.png" width="15" height="15" /></a></div></td>
    </tr>
    <?php
				  $no++;
				  $counter++;
				  $c++;
       }
   ?>
  </table>
  <p> </p>
</form>
</body>
</html><style type="text/css">
<!--
body {
	background-image: url(images/main_bg.png);
}
.style5 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; }
-->
</style><div id="content">
	<h2 align="center">EDIT KATA KAMUS </h2>
	<FORM ACTION="prosesedit.php" METHOD="POST" NAME="" />
	<?php
include "conn.php";
	$query = ("SELECT *
FROM `kamus_id`
WHERE `kata` LIKE '$kta'
LIMIT 0 , 30 ");
	$sql = mysql_query ($query);
	while($c=mysql_fetch_array($sql)){
?>
	
		<table width="391" border="0" align="center" cellpadding="3" cellspacing="0" background="gambar/g.png">
			
			<tr>
			  <td width="17"> </td>
				<td width="129" height="24"><span class="style5">Kata</span></td>
				<td width="227"><label>
				  <input name="kta" type="text" value="<?php echo $c[0] ?>" size="30" />
			  </label></td>
			</tr>
			<tr>
			  <td> </td>
				<td height="51"><span class="style5">Arti</span></td>
				<td><input type="text" name="art" size="30" maxlength="30" value="<?php echo $c[1] ?>"></td>
			</tr>
			<tr>
			  <td> </td>
				<td> </td>
				<td>  
				<input name="Submit" type="submit" value="Simpan">
				 </td>
			</tr>
  </table>
		<div align="center"></div>
		<div align="center">
		  <?php
		
}
?>
		  </FORM>
        </div>
</div>
<?php
include "conn.php";
 $edit = mysql_query ("UPDATE `kamus2`.`kamus_id` SET `kata` = '$kta',
`arti` = '$art'
 WHERE `kamus_id`.`kata` =$kta LIMIT 1 ");
  if ($edit) { ?><script type="text/javascript">
          alert("EDIT BERHASIL");
		  document.location="http://localhost/ta/lihat.php";
			</script>  
			<? } else {
			?><script type="text/javascript">
          alert("GAGAL");
		  document.location="http://localhost/ta/lihat.php";
			</script> <? }
  
   
      ?>        
        <tr>
		<td>No AWB (AirWayBill Number)</td>
		<td> : <input type='text' name='no_awb' id='no_awb'  size='20' lenght='20'></td>
	</tr>
	<tr>
		<td>Nama Pengirim </td>
				<td> : <input type='text' name='nama_kirim' id='nama_kirim'  size='30' lenght='30'></td>
	</tr>
	<tr>
		<td>Alamat </td>
				<td> : <textarea name='alamat' id='alamat'  size='50' lenght='50'></textarea></td>
	</tr>
	 <tr><td>Provinsi</td>
			<td> : <select name='provinsi' id='provinsi'>
            <option value=Not selected>-- Provinsi --</option>";
			$tampil=mysql_query("SELECT * FROM provinsi ORDER BY kode_pro asc");
            while($r=mysql_fetch_array($tampil)){
			if ($r[provinsi]!='provinsi'){
              echo "<option value='$r[provinsi]'>$r[provinsi]</option>";}
            }
			echo "</select></td></tr>
			<tr>
		<td>Kota </td>
				<td> : <input type='text' name='kota' id='kota'  size='30' lenght='30'></td>
	</tr>
	<tr>
		<td>Kode Pos</td>
			<td> : <input type='text' name='kodepos' id='kodepos'  size='8' lenght='8'></td>
	</tr>
	<tr>
		<td>No Handphone </td>
			<td> : <input type='text' name='nohp' id='nohp'  size='20' lenght='20'></td>
	</tr>
	
	<tr>
		<td>Tanggal Pengiriman </td>
			<td> : <input type='text' name='tgl_kirim' id='tgl_kirim'  size='20' lenght='20' class='input'></td>
	</tr>
	<tr>
		<td>Nama Barang </td>
				<td> : <input type='text' name='nama_barang' id='nama_barang'  size='30' lenght='30'></td>
	</tr>
	<tr>
		<td>Kepada</td>
		<td> : <input type='text' name='kepada' id='kepada'  size='30' lenght='30'></td>
	</tr>
	<tr>
		<td>U P</td>
		<td> : <input type='text' name='up' id='up'  size='30' lenght='30'></td>
	</tr>
	<tr>
		<td>Alamat Tujuan</td>
		<td>: <textarea name='alamat_tujuan' id='alamat_tujuan'  size='50' lenght='50'></textarea></td>
	</tr>
	<tr>
		<td>Jenis Kiriman</td>
		<td> : <select name='jenis_kiriman' id='jenis_kiriman'>
		<option value='' selected>- Jenis Kiriman -</option>
		<option value='Dokumen' >Dokumen</option>
		<option value='Paket' >Paket</option>
		</select>
		</td>
	</tr>
		<tr>
		<td>Via</td>
		<td> : <select name='via' id='via'>
		<option value='' selected>- Via -</option>
		<option value='Darat' >Darat</option>
		<option value='Udara' >Udara</option>
				</select>  <font color='red'>  *Jika Berat Barang Yang Dikirim > 20 Kg, Maka Digunakan Via Darat</font>
		</td>
		<tr>
		<td>Layanan</td>
		<td> : <select name='layanan' id='layanan'>
		<option value='' selected>- Layanan -</option>
		<option value='ONS' >ONS</option>
		<option value='Reguler' >Reguler</option>
				</select>
		</td>
	</tr>";
	    
	// Koneksi  
	include "../../inc/inc.koneksi.php"; 
	$result = mysql_query("select harga_kirim.kode, harga_kirim.kode_pro, harga_kirim.kode_kab, harga_kirim.harga, kabupaten.kota from harga_kirim inner join kabupaten on harga_kirim.kode_kab = kabupaten.kode_kab");  
	$jsArray = "var kota = new Array();\n";  
	echo '<tr>
	<td>Tujuan </td><td> : <select name="kode_kab" onchange="document.getElementById(\'harga\').value = harga[this.value]">';  
	echo '<option>- Tujuan -</option>';  
	while ($row = mysql_fetch_array($result)) {  
	 if ($row['layanan'] = 'reguler')
	    		$jsArray  = $_GET['harga'];
				elseif ($row['layanan'] = 'ONS')
				$jsArray  = $_GET['ons'];
			
	    echo '<option value="' . $row['kode_kab'] . '">' . $row['kota'] . '</option>';  
	    $jsArray .= "harga['" . $row['kode_kab'] . "'] = '" . addslashes($row['harga']) . "';\n";  
}  
	echo '</select></td></tr>';  
	?>  
<?php
echo"
		<td>Harga Kirim</td>
		<td>Rp. <input type='text' name='harga' id='harga'  size='20' lenght='20' readonly>"; ?>
		<script type="text/javascript">  
	<?php echo $jsArray; ?>  
	</script> 
	<?php
	echo" 
</td>
	</tr>
	<tr>
		<td>Berat</td>
			<td> : <input type='text' name='berat' id='berat'  size='10' lenght='10'> Kg</td>
	</tr>
		  <td colspan=2>
<input type=submit value=Simpan id='button'>
<input type=button value=Batal onclick=self.history.back() id='button'></td></tr>
          </table></form>";