<?php
$IIIIIII1IIll = file_get_contents('./includes/eggzie.json');
$IIIIIII1IIl1 = json_decode($IIIIIII1IIll, true);
$IIIIIII1II1I = $IIIIIII1IIl1['info'];
$IIIIIII1II1l = $IIIIIII1II1I['vv'];

if ($IIIIIII1II1l == '0') {
    header('Location: users.php');
}

$IIIIIIIIIl11 = file_get_contents('./a/ibo.json');
$IIIIIIIII1II = json_decode($IIIIIIIIIl11, true);
$IIIIIIIII1Il = $IIIIIIIII1II['app_info'];
$IIIIIII1lIlI = $IIIIIIIII1Il['android_version_code'];
$IIIIIII1lIll = $IIIIIIIII1Il['apk_url'];

$IIIIIIIIl1ll = '<div class="alert alert-primary" id="flash-msg"><h4><i class="icon fa fa-check"></i>Detalhes do Apk Atualizados!</h4></div>';

if (isset($_POST['submit'])) {
    $IIIIIIIIl1l1 = file_get_contents('./a/ibo.json');
    $IIIIIIII1Ill = json_decode($IIIIIIIIl1l1, true);
    $IIIIIIII1Il1 = ['app_info' => ['android_version_code' => $_POST['android_version_code'], 'apk_url' => $_POST['apk_url']]];
    $IIIIIIII1I1I = array_replace_recursive($IIIIIIII1Ill, $IIIIIIII1Il1);
    $IIIIIIII1I1l = json_encode($IIIIIIII1I1I, JSON_PRETTY_PRINT);
    file_put_contents('./a/ibo.json', $IIIIIIII1I1l);
    header('Location: update.php?message=' . $IIIIIIIIl1ll);
}

include 'includes/header.php';
?>

<div class="container-fluid">

    <h1 class="h3 mb-1 text-gray-800">Atualização do Apk</h1>

    <div class="row">
        <div class="col-lg-12">
            <div class="card border-left-primary shadow h-100 card shadow mb-4">
                <div class="card-header py-3">
                    <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-refresh"></i> Atualização do Apk</h6>
                </div>
                <div class="card-body">
                    <form method="post">

                        <div class="form-group">
                            <h6 class="form-text"><strong>Código da Versão</strong></h6>
                            <input type="text" class="form-control" placeholder="Código da Versão" name="android_version_code" value="<?= $IIIIIII1lIlI ?>">
                        </div>

                        <div class="form-group">
                            <h6 class="form-text"><strong>URL para Download</strong></h6>
                            <input type="text" class="form-control" placeholder="http://link para app.apk" name="apk_url" value="<?= $IIIIIII1lIll ?>">
                        </div>

                        <button class="btn btn-primary btn-icon-split" name="submit" type="submit">
                            <span class="icon text-white-50"><i class="fas fa-check"></i></span>
                            <span class="text">Enviar</span>
                        </button>

                    </form>
                </div>
            </div>
            <br><br><br><br>
        </div>
    </div>
    <br><br><br>
</div>

<?php
include 'includes/footer.php';
?>

<script>
$(document).ready(function () {
    $("#flash-msg").delay(3000).fadeOut("slow");
});
</script>

</body>
</html>