<?php
require("../../config/koneksi.php");
require("../../config/function.php");
require("../../config/crud.php");

        $ektensi = ['jpg', 'png','svg'];
        if ($_FILES['logo']['name'] <> '') {
            $logo = $_FILES['logo']['name'];
            $temp = $_FILES['logo']['tmp_name'];
            $ext = explode('.', $logo);
            $ext = end($ext);
            if (in_array($ext, $ektensi)) {
                $dest = 'dist/img/logo' . rand(1, 100) . '.' . $ext;
                $upload = move_uploaded_file($temp, '../../' . $dest);
                if ($upload) {
                    $exec = update($koneksi, 'aplikasi', ['logo' => $dest], ['id_aplikasi' => 1]);
                } else {
                    echo "gagal";
                }
            }
        }
       
        if ($_FILES['logokanan']['name'] <> '') {
            $logokanan = $_FILES['logokanan']['name'];
            $temp = $_FILES['logokanan']['tmp_name'];
            $ext = explode('.', $logokanan);
            $ext = end($ext);
            if (in_array($ext, $ektensi)) {
                $dest = 'dist/img/logokanan' . '.' . $ext;
                $upload = move_uploaded_file($temp, '../../' . $dest);
                if ($upload) {
                    $exec = update($koneksi, 'aplikasi', ['logo_kanan' => $dest], ['id_aplikasi' => 1]);
                } else {
                    echo "gagal";
                }
            }
        }
		
    



