	<div align="center">
		<img src="../images/loading.gif" border="0"> <br>
		Uploading on Progress ..		
	</div>
	<?php
	include('../koneksi.php');	
	$module = $_REQUEST["module"];
	$action = $_REQUEST["action"];
	// echo "action = ".$action;
	// echo "<br> modul = ".$module;
	if ($koneksi){		
		if($module=="about_us") {
			if($action=="edit") {
				@ $id = $_POST["id"];
				@ $id2 = $_POST["id2"];
				// @ $tanggal = $_REQUEST["thn"]."-".$_REQUEST["bln"]."-".$_REQUEST["tgl"];
				@ $title = $_POST["title"];
				@ $deskripsi = $_POST["deskripsi"];
				$deskripsi = str_replace("'", "&acute;", $deskripsi);	
				$deskripsi = str_replace(chr(13), "", $deskripsi);	
				$deskripsi = str_replace(chr(10), "", $deskripsi);							

				if ($id) {
					$query="update about set title='".$title."', deskripsi='".$deskripsi."' where id=".$id;
				} else if ($id2) {
					$query="update about_detil set title='".$title."', deskripsi='".$deskripsi."' where id=".$id2;
				}
				
				if ($hasil=mysql_query($query)) {
					echo "<script language=JavaScript>";
						@ $alamat="location.href = 'about_us.php?menu=2";
						if($id) $alamat=$alamat."&id=".$id; 
							else $alamat=$alamat."&id2=".$id2;
						$alamat=$alamat."';";
						echo $alamat;				
					echo "</script>";						
				} else {
					echo "ERROR! <br>";
					echo "Sql : ".$query;
				}

			  		
			} else if($action=="delete") {
				@ $id = $_REQUEST["id"];
				@ $gambar = $_REQUEST["gambar"];
				
				if ($gambar) {
					$uploaddir = '../images/journal/';
					chmod($uploaddir . $gambar, 0755);
					unlink ($uploaddir . $gambar);
				}
				
				$query="delete from tbjournal where pkid=".$id;
				$hasil=mysql_query($query);
				//echo $query;					

				echo "<script language=JavaScript>";
					@ $alamat="location.href = 'archives.php?menu=3";
					if($hasil) $alamat=$alamat."&err=0"; else $alamat=$alamat."&err=1";
					$alamat=$alamat."';";
					echo $alamat;			
				echo "</script>";
			}
		}  else if($module=="services") {
			if($action=="edit") {
				@ $id = $_POST["id"];
				@ $id2 = $_POST["id2"];
				// @ $tanggal = $_REQUEST["thn"]."-".$_REQUEST["bln"]."-".$_REQUEST["tgl"];
				@ $title = $_POST["title"];
				@ $deskripsi = $_POST["deskripsi"];
				$deskripsi = str_replace("'", "&acute;", $deskripsi);	
				$deskripsi = str_replace(chr(13), "", $deskripsi);	
				$deskripsi = str_replace(chr(10), "", $deskripsi);							

				if ($id) {
					$query="update services set title='".$title."', deskripsi='".$deskripsi."' where id=".$id;
				} else if ($id2) {
					$query="update services_detil set title='".$title."', deskripsi='".$deskripsi."' where id=".$id2;
				}
				
				if ($hasil=mysql_query($query)) {
					echo "<script language=JavaScript>";
						@ $alamat="location.href = 'services.php?menu=3";
						if($id) $alamat=$alamat."&id=".$id; 
							else $alamat=$alamat."&id2=".$id2;
						$alamat=$alamat."';";
						echo $alamat;				
					echo "</script>";						
				} else {
					echo "ERROR! <br>";
					echo "Sql : ".$query;
				}
			} else if($action=="delete") {
				@ $id = $_REQUEST["id"];
				@ $gambar = $_REQUEST["gambar"];
				
				if ($gambar) {
					$uploaddir = '../images/journal/';
					chmod($uploaddir . $gambar, 0755);
					unlink ($uploaddir . $gambar);
				}
				
				$query="delete from tbjournal where pkid=".$id;
				$hasil=mysql_query($query);
				//echo $query;					

				echo "<script language=JavaScript>";
					@ $alamat="location.href = 'archives.php?menu=3";
					if($hasil) $alamat=$alamat."&err=0"; else $alamat=$alamat."&err=1";
					$alamat=$alamat."';";
					echo $alamat;			
				echo "</script>";
			}
		}  else if($module=="experiences") {
			if($action=="edit") {
				@ $id = $_POST["id"];
				@ $id2 = $_POST["id2"];
				// @ $tanggal = $_REQUEST["thn"]."-".$_REQUEST["bln"]."-".$_REQUEST["tgl"];
				@ $title = $_POST["title"];
				@ $deskripsi = $_POST["deskripsi"];
				$deskripsi = str_replace("'", "&acute;", $deskripsi);	
				$deskripsi = str_replace(chr(13), "", $deskripsi);	
				$deskripsi = str_replace(chr(10), "", $deskripsi);							

				if ($id) {
					$query="update experiences set title='".$title."', deskripsi='".$deskripsi."' where id=".$id;
				} else if ($id2) {
					$query="update experiences_detil set title='".$title."', deskripsi='".$deskripsi."' where id=".$id2;
				}
				
				if ($hasil=mysql_query($query)) {
					echo "<script language=JavaScript>";
						@ $alamat="location.href = 'experiences.php?menu=4";
						if($id) $alamat=$alamat."&id=".$id; 
							else $alamat=$alamat."&id2=".$id2;
						$alamat=$alamat."';";
						echo $alamat;				
					echo "</script>";						
				} else {
					echo "ERROR! <br>";
					echo "Sql : ".$query;
				}
			} else if($action=="delete") {
				@ $id = $_REQUEST["id"];
				@ $gambar = $_REQUEST["gambar"];
				
				if ($gambar) {
					$uploaddir = '../images/journal/';
					chmod($uploaddir . $gambar, 0755);
					unlink ($uploaddir . $gambar);
				}
				
				$query="delete from tbjournal where pkid=".$id;
				$hasil=mysql_query($query);
				//echo $query;					

				echo "<script language=JavaScript>";
					@ $alamat="location.href = 'archives.php?menu=3";
					if($hasil) $alamat=$alamat."&err=0"; else $alamat=$alamat."&err=1";
					$alamat=$alamat."';";
					echo $alamat;			
				echo "</script>";
			}
		}  else if($module=="news") {
			$id = $_POST["id"];
			$id2 = $_POST["id2"];
			$type = $_POST["type"];			
			$tanggal = $_POST["thn"]."-".$_POST["bln"]."-".$_POST["tgl"];
			$source = $_POST["source"];
			$link = $_POST["link"];
			$title = $_POST["title"];
			$tampil = $_POST["tampil"];
			
			$deskripsi = $_POST["deskripsi"];
			$deskripsi = str_replace("'", "&acute;", $deskripsi);	
			$deskripsi = str_replace(chr(13), "", $deskripsi);	
			$deskripsi = str_replace(chr(10), "", $deskripsi);							
			
			$gambar = $_FILES['gambar']['name'];
			$old_gambar = $_POST["old_gambar"];
			
			$deskripsi2 = $_POST["deskripsi2"];
			$deskripsi2 = str_replace("'", "&acute;", $deskripsi2);	
			$deskripsi2 = str_replace(chr(13), "", $deskripsi2);	
			$deskripsi2 = str_replace(chr(10), "", $deskripsi2);							
		
			if($action=="add") {
				$img="";
				if ($gambar) {
					$segment = split ("[.]", $gambar);
					$ext = $segment[count ($segment) - 1];
					$uploaddir = '../images/content/news/';
					if (move_uploaded_file($_FILES['gambar']['tmp_name'], $uploaddir . $gambar)){
						chmod($uploaddir . $gambar,0755);
						$img = "venuemagz-" . date("YmdGis") . "." . $ext;
						if (rename ($uploaddir . $gambar, $uploaddir . $img)) {
						}
					} 
				}
				$query="insert into content values(null,'2','0','".$tanggal."','$title','', '', '".$deskripsi."','','".$img."','".$deskripsi2."', '', '', '0', '1')";
				if ($hasil=mysql_query($query)) {
					echo "<script language=JavaScript>";
						 $alamat="location.href = 'news.php?menu=2";
						if($id) $alamat=$alamat."&id=".$id; 
						$alamat=$alamat."';";
						echo $alamat;				
					echo "</script>";						
				} else {
					echo "ERROR! <br>";
					echo "Sql : ".$query;
				}
			} else if($action=="edit") {
				if ($id) {					
					if (!$gambar && $old_gambar) $img = $old_gambar;
					else $img = "new-saaj-" . date("YmdGis") . "." . $ext;
					
					$query="update news set tanggal='".$tanggal."', source='".$source."', link='".$link."', title='".$title."', deskripsi='".$deskripsi."', gambar='".$img."', ket_gambar='".$deskripsi2."', tampil='".$tampil."' where id=".$id;
					if ($hasil=mysql_query($query)) {
						if ($gambar) {
							@ $segment = split ("[.]", $gambar);
							@ $ext = $segment[count ($segment) - 1];
							$uploaddir = '../images/news/';
							if (move_uploaded_file($_FILES['gambar']['tmp_name'], $uploaddir . $gambar)){
								chmod($uploaddir . $gambar,0755);
								rename ($uploaddir . $gambar, $uploaddir . $img);
							} 
						}
						
						echo "<script language=JavaScript>";
							@ $alamat="location.href = 'news.php?menu=5";
							if($type) $alamat=$alamat."&id=".$type; 
							$alamat=$alamat."';";
							echo $alamat;				
						echo "</script>";						
					} else {
						echo "ERROR! <br>";
						echo "Sql : ".$query;
					}
				}			
			} else if($action=="delete") {
				if ($id) {					
					$query="delete from news where id=".$id2;
					if ($hasil=mysql_query($query)) {
						if ($gambar) {
							$uploaddir = '../images/news/';
							unlink($uploaddir.$gambar);
						}
						
						echo "<script language=JavaScript>";
							@ $alamat="location.href = 'news.php?menu=5";
							if($id) $alamat=$alamat."&id=".$id; 
							$alamat=$alamat."';";
							echo $alamat;				
						echo "</script>";						
					} else {
						echo "ERROR! <br>";
						echo "Sql : ".$query;
					}
				}			
			}
		}  else if($module=="publications") {
			@ $id = $_POST["id"];	
			@ $tanggal = $_POST["thn"]."-".$_POST["bln"]."-".$_POST["tgl"];
			@ $type = $_POST["type"];
			@ $subtype = $_POST["subtype"];
				if (!$subtype) $subtype=0;			
			@ $title = $_POST["title"];
			@ $tampil = $_POST["tampil"];
			
			@ $deskripsi = $_POST["deskripsi"];
			$deskripsi = str_replace("'", "&acute;", $deskripsi);	
			$deskripsi = str_replace(chr(13), "", $deskripsi);	
			$deskripsi = str_replace(chr(10), "", $deskripsi);							
			
			@ $gambar = $_FILES['gambar']['name'];
			@ $old_gambar = $_POST["old_gambar"];
			
			@ $dokumen1 = $_FILES['dokumen1']['name'];
			@ $old_dokumen = $_POST["old_dokumen"];
			
			// echo "<br>"."Dokumen : ".$dokumen1."<br>";
			// echo "<br>"."Old Dokumen : ".$old_dokumen."<br>";
			
			$lokasi = "../download/publications/";
			if ($type) $lokasi = $lokasi.$type."/"; 
			if ($subtype!=0) $lokasi = $lokasi.$subtype."/"; 
			if (!file_exists($lokasi)) {
				mkdir($lokasi, 0755);
			}
			$lokasi = $lokasi.$_POST["thn"]."/";
			if (!file_exists($lokasi)) {
				mkdir($lokasi, 0755);
			}
			

			//echo "Lokasi: ".$lokasi;
			
			if($action=="ADD") {
				if ($gambar) {
					$uploaddir = $lokasi;
					if (move_uploaded_file($_FILES['gambar']['tmp_name'], $uploaddir . $gambar)){
						chmod($uploaddir . $gambar,0755);
					} 
				} else $gambar = $old_gambar;

				if ($dokumen1) {
					$uploaddir = $lokasi;
					if (move_uploaded_file($_FILES['dokumen1']['tmp_name'], $uploaddir . $dokumen1)){
						chmod($uploaddir . $dokumen1,0755);
					} 
				} else $dokumen1 = $old_dokumen;
				
				$query="insert into publications_trans values(null,'".$tanggal."','".$type."','".$subtype."','".$title."','".$deskripsi."','".$gambar."','".$dokumen1."', '".$tampil."')";
				if ($hasil=mysql_query($query)) {
					echo "<script language=JavaScript>";
						@ $alamat="location.href = 'publication.php?menu=6";

						if($type && $subtype) {
							$alamat=$alamat."&id2=".$subtype; 
						} else {
							if($type) $alamat=$alamat."&id=".$type; 
							if($subtype) $alamat=$alamat."&id2=".$subtype; 
						} 
						$alamat=$alamat."';";

						echo $alamat;				
					echo "</script>";						
				} else {
					echo "ERROR! <br>";
					echo "Sql : ".$query;
				}
			} else if($action=="EDIT") {
				if ($id) {					
					if ($gambar) {
						$uploaddir = $lokasi;
						if (move_uploaded_file($_FILES['gambar']['tmp_name'], $uploaddir . $gambar)){
							chmod($uploaddir . $gambar,0755);
							if ($old_gambar) {
								@unlink($uploaddir.$old_gambar);
								// echo "<br>"."Gambar : ".$uploaddir.$old_gambar;
							}
						} 
					} else $gambar = $old_gambar;
	
					if ($dokumen1) {
						$uploaddir = $lokasi;
						// echo "<br>"."Dokumen : ".$uploaddir.$dokumen1;
						
						if (move_uploaded_file($_FILES['dokumen1']['tmp_name'], $uploaddir . $dokumen1)){
							// echo "<br> Dokumen 1 Ada !!";
							chmod($uploaddir . $dokumen1,0755);
							if ($old_dokumen) {
								@unlink($uploaddir.$old_dokumen);
								// echo "<br>"."Dokumen : ".$uploaddir.$old_dokumen;
							}
						} 
					} else $dokumen1 = $old_dokumen;
	
					$query="update publications_trans set tanggal='".$tanggal."', type='".$type."', subtype='".$subtype."', title='".$title."', description='".$deskripsi."', gambar='".$gambar."', dokumen1='".$dokumen1."', tampil='".$tampil."' where id='".$id."'";
					// echo "<p></p>".$query;
					
					if ($hasil=mysql_query($query)) {
						echo "<script language=JavaScript>";
							@ $alamat="location.href = 'publication.php?menu=6";
							
							if($type && $subtype) {
								$alamat=$alamat."&id2=".$subtype; 
							} else {
								if($type) $alamat=$alamat."&id=".$type; 
								if($subtype) $alamat=$alamat."&id2=".$subtype; 
							} 
							$alamat=$alamat."';";

							echo $alamat;				
						echo "</script>";						
					} else {
						echo "ERROR! <br>";
						echo "Sql : ".$query;
					}
				}			
			} else if($action=="DELETE") {
				if ($id) {
					//echo "hasil: ".$lokasi.$gambar;					
					$uploaddir = $lokasi;
					$query="delete from publications_trans where id=".$id;
					if ($hasil=mysql_query($query)) {
						chmod($uploaddir.$old_gambar,0755);
						if ($old_gambar) {
							//echo $uploaddir.$old_gambar;
							unlink($uploaddir.$old_gambar);
						}
						
						chmod($uploaddir.$old_dokumen,0755);
						if ($old_dokumen) {
							unlink($uploaddir.$old_dokumen);
						}
						
						echo "<script language=JavaScript>";
							@ $alamat="location.href = 'publication.php?menu=6";

							if($type && $subtype) {
								$alamat=$alamat."&id2=".$subtype; 
							} else {
								if($type) $alamat=$alamat."&id=".$type; 
								if($subtype) $alamat=$alamat."&id2=".$subtype; 
							} 
							$alamat=$alamat."';";

							echo $alamat;				
						echo "</script>";						
					} else {
						echo "ERROR! <br>";
						echo "Sql : ".$query;
					}
				}			
			}
		}  else if($module=="event") {
			@ $id = $_POST["id"];
			@ $date_start = $_POST["thn"]."-".$_POST["bln"]."-".$_POST["tgl"];
			@ $date_end = $_POST["thn2"]."-".$_POST["bln2"]."-".$_POST["tgl2"];
			@ $tahun = $_POST["tahun"];
				if ($tahun=="") $tahun=$_POST["thn"];
			@ $waktu = $_POST["waktu"];
			@ $title = $_POST["title"];
			@ $theme = $_POST["theme"];
			@ $venue = $_POST["venue"];
			
			@ $deskripsi = $_POST["deskripsi"];
			$deskripsi = str_replace("'", "&acute;", $deskripsi);	
			$deskripsi = str_replace(chr(13), "", $deskripsi);	
			$deskripsi = str_replace(chr(10), "", $deskripsi);							
			
			@ $brosur = $_FILES['brosur']['name'];
			@ $old_brosur = $_POST["old_brosur"];

			@ $reg_form = $_FILES['reg_form']['name'];
			@ $old_reg_form = $_POST["old_reg_form"];
			
			@ $gambar = $_FILES['gambar']['name'];
			@ $old_gambar = $_POST["old_gambar"];

			$uploaddir = '../event/'.$tahun.'/';
			
			if (!$gambar && $old_gambar) $img = $old_gambar;
			else {
				@ $segment = split ("[.]", $gambar);
				@ $ext = $segment[count ($segment) - 1];
				$img = "aaj_logo_event" . date("YmdGis") . "." . $ext;
			}
			
			if (!$reg_form && $old_reg_form) $form_reg = $old_reg_form;
			else {
				@ $segment = split ("[.]", $reg_form);
				@ $ext = $segment[count ($segment) - 1];
				$form_reg = "aaj_form_event" . date("YmdGis") . "." . $ext;
			}
			
			if (!$brosur && $old_brosur) $brosur1 = $old_brosur;
			else {
				@ $segment = split ("[.]", $brosur);
				@ $ext = $segment[count ($segment) - 1];
				$brosur1 = "aaj_brochure_event" . date("YmdGis") . "." . $ext;
			}

			if ($gambar) {							
				if (move_uploaded_file($_FILES['gambar']['tmp_name'], $uploaddir . $gambar)){
					chmod($uploaddir . $gambar,0755);
					if (rename ($uploaddir . $gambar, $uploaddir . $img)) {
						$filename=$uploaddir.$old_gambar;
						if ($old_gambar) {
							unlink ($filename);
						}
					}
				} 
			}
			
			if ($brosur) {
				if (move_uploaded_file($_FILES['brosur']['tmp_name'], $uploaddir . $brosur)){
					chmod($uploaddir . $brosur,0755);
					if (rename ($uploaddir . $brosur, $uploaddir . $brosur1)) {
						$filename=$uploaddir.$old_brosur;
						if ($old_brosur) {
							unlink ($filename);
						}
					}
				} 
			}
	
			if ($reg_form) {
				@ $segment = split ("[.]", $reg_form);
				@ $ext = $segment[count ($segment) - 1];
				if (move_uploaded_file($_FILES['reg_form']['tmp_name'], $uploaddir . $reg_form)){
					chmod($uploaddir . $reg_form,0755);
					if (rename ($uploaddir . $reg_form, $uploaddir . $form_reg)) {
						$filename=$uploaddir.$old_reg_form;
						if ($old_reg_form) {
							unlink ($filename);
						}
					}
				} 
			}
			
			if($action=="add") {
				$query="insert into event values (null, '".$date_start."', '".$date_end."', '".$waktu."', '".$title."', '".$theme."', '".$venue."', '".$deskripsi."', '".$brosur1."', '".$form_reg."', '".$img."')";
				// echo $query;
				if ($hasil=mysql_query($query)) {
					echo "<script language=JavaScript>";
						@ $alamat="location.href = 'event.php?menu=7";
						$alamat=$alamat."';";
						echo $alamat;				
					echo "</script>";						
				} else {
					echo "ERROR! <br>";
					echo "Sql : ".$query;
				}
			} else if($action=="edit") {
				// echo "aksinya";
				if ($id) {					
					$query="update event set date_start='".$date_start."', date_end='".$date_end."', waktu='".$waktu."', title='".$title."', theme='".$theme."', venue='".$venue."', deskripsi='".$deskripsi."', brosur='".$brosur1."', reg_form='".$form_reg."', gambar='".$img."' where id=".$id;
					// echo $query;
					if ($hasil=mysql_query($query)) {
						echo "<script language=JavaScript>";
							@ $alamat="location.href = 'event.php?menu=7";
							if($id) $alamat=$alamat."&id=".$id; 
							$alamat=$alamat."';";
							echo $alamat;				
						echo "</script>";						
					} else {
						echo "ERROR! <br>";
						echo "Sql : ".$query;
					}
				}			
			} else if($action=="delete") {
				if ($id) {					
					$query="delete from event where id=".$id;
					// echo $query;
					if ($hasil=mysql_query($query)) {
						
						$filename=$uploaddir.$old_gambar;
						if ($old_gambar) {
							unlink ($filename);
						}

						$filename=$uploaddir.$old_brosur;
						if ($old_brosur) {
							unlink ($filename);
						}

						$filename=$uploaddir.$old_reg_form;
						if ($old_reg_form) {
							unlink ($filename);
						}

						echo "<script language=JavaScript>";
							@ $alamat="location.href = 'event.php?menu=7";
							// if($id) $alamat=$alamat."&id=".$id; 
							$alamat=$alamat."';";
							echo $alamat;				
						echo "</script>";						
					} else {
						echo "ERROR! <br>";
						echo "Sql : ".$query;
					}
				}			
			}
		}  else if($module=="") {
		}  else if($module=="") {
		}  else if($module=="") {
		}
	} 
	?>