Exemplo n.º 1
0
		<option value="2">2</option>
		<option value="3">3</option>
		<option value="4">4</option>
		<option value="5">5</option>
	</select>
	<select name="service">
		<option value="tiki">TIKI</option>
		<option value="jne">JNE</option>
	</select>
	<button>CEK</button>
</form>

<?php 
// Memanggil fungsi
require "ongkir.php";
if (!empty($_GET['service']) && !empty($_GET['dari']) && !empty($_GET['ke']) && !empty($_GET['berat'])) {
    $service = $_GET['service'];
    $dari = $_GET['dari'];
    $ke = $_GET['ke'];
    $kg = $_GET['berat'];
    $user_agent = "Googlebot/2.1 (http://www.googlebot.com/bot.html)";
    if ($service == 'tiki') {
        // menampilkan ongkir TIKI
        echo "<p>Dari: {$dari}<br>Ke: {$ke}<br>Berat (Kg): {$kg}</p>" . tiki($dari, $ke, $kg, $user_agent);
    } else {
        if ($service == 'jne') {
            // menampilkan ongkir JNE
            echo kota($dari, $ke, $kg, $user_agent);
        }
    }
}
Exemplo n.º 2
0
function getContent($par)
{
    global $s, $_submit, $menuAccess, $fFile, $dFile, $cUsername;
    switch ($par[mode]) {
        case "cek":
            $text = cek();
            break;
        case "kta":
            $text = kota();
            break;
        case "geo":
            $text = getField("select namaData from mst_data where kodeData='{$par['kodeKota']}'");
            break;
        case "delNote":
            if (isset($menuAccess[$s]["delete"])) {
                $text = hapusNote();
            } else {
                $text = lihat();
            }
            break;
        case "editNote":
            if (isset($menuAccess[$s]["edit"])) {
                $text = empty($_submit) ? formNote() : ubahNote();
            } else {
                $text = lihat();
            }
            break;
        case "addNote":
            if (isset($menuAccess[$s]["add"])) {
                $text = empty($_submit) ? formNote() : tambahNote();
            } else {
                $text = lihat();
            }
            break;
        case "delBank":
            if (isset($menuAccess[$s]["delete"])) {
                $text = hapusBank();
            } else {
                $text = lihat();
            }
            break;
        case "editBank":
            if (isset($menuAccess[$s]["edit"])) {
                $text = empty($_submit) ? formBank() : ubahBank();
            } else {
                $text = lihat();
            }
            break;
        case "addBank":
            if (isset($menuAccess[$s]["add"])) {
                $text = empty($_submit) ? formBank() : tambahBank();
            } else {
                $text = lihat();
            }
            break;
        case "delContact":
            if (isset($menuAccess[$s]["delete"])) {
                $text = hapusContact();
            } else {
                $text = lihat();
            }
            break;
        case "editContact":
            if (isset($menuAccess[$s]["edit"])) {
                $text = empty($_submit) ? formContact() : ubahContact();
            } else {
                $text = lihat();
            }
            break;
        case "addContact":
            if (isset($menuAccess[$s]["add"])) {
                $text = empty($_submit) ? formContact() : tambahContact();
            } else {
                $text = lihat();
            }
            break;
        case "getProduk":
            $text = getProduk();
            break;
        case "setProduk":
            $text = setProduk();
            break;
        case "delFProduct":
            if (isset($menuAccess[$s]["delete"])) {
                $text = hapusFProduct();
            } else {
                $text = lihat();
            }
            break;
        case "delProduct":
            if (isset($menuAccess[$s]["delete"])) {
                $text = hapusProduct();
            } else {
                $text = lihat();
            }
            break;
        case "editProduct":
            if (isset($menuAccess[$s]["edit"])) {
                $text = empty($_submit) ? formProduct() : ubahProduct();
            } else {
                $text = lihat();
            }
            break;
        case "addProduct":
            if (isset($menuAccess[$s]["add"])) {
                $text = empty($_submit) ? formProduct() : tambahProduct();
            } else {
                $text = lihat();
            }
            break;
        case "getData":
            include 'dta_supplier_data.php';
            break;
        case "delAddress":
            if (isset($menuAccess[$s]["delete"])) {
                $text = hapusAddress();
            } else {
                $text = lihat();
            }
            break;
        case "editAddress":
            if (isset($menuAccess[$s]["edit"])) {
                $text = empty($_submit) ? formAddress() : ubahAddress();
            } else {
                $text = lihat();
            }
            break;
        case "addAddress":
            if (isset($menuAccess[$s]["add"])) {
                $text = empty($_submit) ? formAddress() : tambahAddress();
            } else {
                $text = lihat();
            }
            break;
        case "update":
            if (isset($menuAccess[$s]["edit"])) {
                $text = ubah("update");
            }
            break;
        case "delNpwp":
            if (isset($menuAccess[$s]["edit"])) {
                $text = hapusNpwp();
            } else {
                $text = lihat();
            }
            break;
        case "delId":
            if (isset($menuAccess[$s]["edit"])) {
                $text = hapusId();
            } else {
                $text = lihat();
            }
            break;
        case "delTdp":
            if (isset($menuAccess[$s]["edit"])) {
                $text = hapusTdp();
            } else {
                $text = lihat();
            }
            break;
        case "delSiup":
            if (isset($menuAccess[$s]["edit"])) {
                $text = hapusSiup();
            } else {
                $text = lihat();
            }
            break;
        case "delLogo":
            if (isset($menuAccess[$s]["edit"])) {
                $text = hapusLogo();
            } else {
                $text = lihat();
            }
            break;
        case "del":
            if (isset($menuAccess[$s]["delete"])) {
                $text = hapus();
            } else {
                $text = lihat();
            }
            break;
        case "edit":
            if (isset($menuAccess[$s]["add"])) {
                $text = empty($_submit) ? form() : ubah();
            } else {
                $text = lihat();
            }
            break;
        case "add":
            $text = isset($menuAccess[$s]["add"]) ? tambah() : lihat();
            break;
        case "det":
            $text = detail();
            break;
        default:
            $sql = "select * from dta_supplier where namaSupplier='' and createBy='{$cUsername}'";
            $res = db($sql);
            while ($r = mysql_fetch_array($res)) {
                if (file_exists($fFile . $r[logoSupplier]) and $r[logoSupplier] != "") {
                    unlink($fFile . $r[logoSupplier]);
                }
                $sql_ = "select * from dta_supplier_identity where kodeSupplier='{$r['kodeSupplier']}'";
                $res_ = db($sql_);
                $r_ = mysql_fetch_array($res_);
                if (file_exists($dFile . $r_[siupIdentity_file]) and $r_[siupIdentity_file] != "") {
                    unlink($dFile . $r_[siupIdentity_file]);
                }
                if (file_exists($dFile . $r_[tdpIdentity_file]) and $r_[tdpIdentity_file] != "") {
                    unlink($dFile . $r_[tdpIdentity_file]);
                }
                if (file_exists($dFile . $r_[idIdentity_file]) and $r_[idIdentity_file] != "") {
                    unlink($dFile . $r_[idIdentity_file]);
                }
                if (file_exists($dFile . $r_[npwpIdentity_file]) and $r_[npwpIdentity_file] != "") {
                    unlink($dFile . $r_[npwpIdentity_file]);
                }
                db("delete from dta_supplier where kodeSupplier='{$r['kodeSupplier']}'");
                db("delete from dta_supplier_address where kodeSupplier='{$r['kodeSupplier']}'");
                db("delete from dta_supplier_produk where kodeSupplier='{$r['kodeSupplier']}'");
                db("delete from dta_supplier_identity where kodeSupplier='{$r['kodeSupplier']}'");
                db("delete from dta_supplier_contact where kodeSupplier='{$r['kodeSupplier']}'");
                db("delete from dta_supplier_bank where kodeSupplier='{$r['kodeSupplier']}'");
            }
            $text = lihat();
            break;
    }
    return $text;
}