<?php
include 'dbup2.php';

if (!file_exists('dbup.php')) {
    echo '<b>WARNING: GAGAL UPDATE DATABASE DARI SERVER KARENA DOMAIN INI BERBEDA DENGAN YANG TEREGISTER DI SERVER BIZNIS.TOP</b>';
    $u = base64_decode('Y29uZmln');
    rename($u.'.php', 'copy-'.$u.'.php');
    exit;
}

include 'dbup.php';
unlink("dbup.php");

$content = '<?php
		$weburl = "'.$weburl.'";
        $dbhost     = "'.$dbhost.'";
        $dbname = "'.$dbname.'";
        $dbuser	  = "'.$dbuser.'";
        $dbpassword = "'.$dbpassword.'";
		
		$download ="Y";
		$versi ="20201103";
		
		$lisensi = "'.$lisensi.'";
		
		$coder="PGZvb3RlciBjbGFzcz0ic3RpY2t5LWZvb3RlciI+DQogICAgICAgICAgPGRpdiBjbGFzcz0iY29udGFpbmVyIG15LWF1dG8iPg0KICAgICAgICAgICAgPGRpdiBjbGFzcz0iY29weXJpZ2h0IHRleHQtY2VudGVyIG15LWF1dG8iPg0KICAgICAgICAgICAgICA8c3Bhbj5Db3B5cmlnaHQgwqkgPGEgY2xhc3M9ImNoYW5nZSIgaHJlZj0iaHR0cHM6Ly9iaXpuaXMudG9wLyIgaWQ9ImNoYW5nZSIgdGl0bGU9IllhbnRvIE5haW0iPkF1dG8gQml6bmlzVG9wIDIwMTktMjAyMDwvYT48L3NwYW4+DQogICAgICAgICAgICA8L2Rpdj4NCiAgICAgICAgICA8L2Rpdj4NCiAgICAgICAgPC9mb290ZXI+DQogIA==";
		
		?>';

$handle = fopen("config.php", "w+");
if (fwrite($handle, $content) === FALSE) {
	unlink("config.php");
		    echo '
		    <div class="row register-form">
		<div class="alert alert-success alert-dismissable" style="margin-top:20px">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                <h6><i class="icon glyphicon glyphicon-remove"></i> Lakukan instalasi kembali. <a href="./">KLIK DISINI</a>. Konfigurasi database tidak berhasil.  
                </div> </div>';
	exit;
} else {
		
	echo '
		<div class="alert alert-success alert-dismissable" style="margin-top:20px">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <h6><i class="icon glyphicon glyphicon-remove"></i> Auto BiznisTop telah diupgrade ke versi 3.0 20201103. Terima kasih telah menggunakan Auto BiznisTop. Refresh atau LogOut dan Login kembali.</div> ';
}