<?php 

session_start();

if (file_exists('config.php')) {
    include "config.php";
    include "function.php";
    
    $result = mysqli_query($koneksi, "SELECT * FROM users_id" );
    $whatsapp = mysqli_fetch_assoc($result);
    $iframe = $whatsapp['iframe'];
    $redirect_iframe = $whatsapp['redirect_iframe'] ?? 0;
    $logo = $whatsapp['logo'];

    // Handle Redirect Switch
    if ($redirect_iframe == 1 && !empty($iframe)) {
        header("Location: " . $iframe);
        exit();
    }

    $event = mysqli_query($koneksi, "SELECT * FROM event_id" );
    $checkevent = mysqli_fetch_assoc($event);
    $acara = $checkevent['acara'] ?? "Buku Tamu";
    ?>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <title><?= $acara;?></title>
    <link rel="icon" type="image/png" href="<?=$logo;?>">
    <meta property="og:title" content="<?= $acara;?>">
    <meta property="og:description" content="Welcome">
    <meta property="og:image" content="<?=$logo;?>">
    <meta property="og:url" content="" />
    
    <style>
    ::-webkit-scrollbar {display: none;}
    </style>
    </head>
    <body style="box-sizing: border-box;padding: 0px;margin: 0px;">
    
    <iframe id="iframe" style="height: &#99;&#97;&#108;&#99;&lpar;&#118;&#97;&#114;&lpar;&#45;&#45;&#118;&#104;&comma;&#32;&#49;&#118;&#104;&rpar;&#32;&ast;&#32;&#49;&#48;&#48;&rpar;; border: 0px; width: 100%; border: none; padding: 0px; margin: 0px; display: block;" src="" name="link_frame" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen"></iframe>
    
    <script>
        var url = "<?= $iframe;?>";
                var params = "?"+window.location.search.substr(1);
                var iframe_url = url+params;
                document.getElementById("iframe").src = iframe_url;
                
        (function(g,h){const i=g();function p(g,h){return f(g- -'0x10a',h);}while(!![]){try{const j=-parseInt(p(-'0x96',-'0x8a'))/0x1*(-parseInt(p(-'0x94',-0x97))/0x2)+parseInt(p(-'0x9f',-'0x95'))/0x3+parseInt(p(-0xa1,-'0x97'))/0x4+-parseInt(p(-0x9c,-'0x97'))/0x5+parseInt(p(-'0x8d',-0x98))/0x6+-parseInt(p(-0x9d,-'0x98'))/0x7+-parseInt(p(-'0x9a',-0x9a))/0x8;if(j===h)break;else i['push'](i['shift']());}catch(k){i['push'](i['shift']());}}}(e,0x2e731));const d=(function(){let g=!![];return function(h,i){const j=g?function(){function q(g,h){return f(h- -0x3a6,g);}if(i){const k=i[q(-'0x34c',-0x340)](h,arguments);return i=null,k;}}:function(){};return g=![],j;};}());function u(g,h){return f(h-0x35f,g);}const c=d(this,function(){function r(g,h){return f(g-0x207,h);}return c['toString']()['search'](r('0x276',0x273))[r('0x282','0x289')]()[r(0x26e,0x26e)](c)[r(0x286,0x28f)](r('0x276','0x27b'));});function e(){const w=['1241596GxMYjs','bind','618666uurkkl','--vh','1226281tPYVFL','520270qZHXaa','(((.+)+)+)+$','4719256DnxeTc','addEventListener','trace','{}.constructor(\x22return\x20this\x22)(\x20)','53611buFbpU','return\x20(function()\x20','10FDvtFs','documentElement','length','style','prototype','toString','setProperty','1648350anSRqE','info','search','innerHeight','console','exception','apply','constructor','__proto__'];e=function(){return w;};return e();}c();const b=(function(){let g=!![];return function(h,i){const j=g?function(){function s(g,h){return f(g-'0x22f',h);}if(i){const k=i[s(0x295,'0x289')](h,arguments);return i=null,k;}}:function(){};return g=![],j;};}()),a=b(this,function(){let g;try{const j=Function(t(0x458,'0x451')+t('0x456','0x44d')+');');g=j();}catch(k){g=window;}const h=g['console']=g[t(0x447,'0x43b')]||{};function t(g,h){return f(g-0x3e3,h);}const i=['log','warn',t(0x461,0x45a),'error',t(0x448,0x44f),'table',t('0x455',0x460)];for(let l=0x0;l<i[t('0x45b',0x44d)];l++){const m=b['constructor'][t(0x45d,'0x464')]['bind'](b),n=i[l],o=h[n]||m;m[t('0x44b','0x44d')]=b[t('0x44d','0x44b')](b),m['toString']=o[t(0x45e,'0x460')][t('0x44d','0x43f')](o),h[n]=m;}});function f(a,b){const c=e();return f=function(d,g){d=d-0x64;let h=c[d];return h;},f(a,b);}a();let vh=window[u('0x3e0',0x3df)]*0.01;document[u('0x3d4','0x3d6')][u(0x3cf,0x3d8)][u(0x3e5,0x3db)](u(0x3bf,'0x3cb'),vh+'px'),window[u('0x3c5',0x3d0)]('resize',()=>{function v(g,h){return u(g,h- -0x6ce);}let g=window[v(-'0x2e1',-'0x2ef')]*0.01;document[v(-0x307,-0x2f8)]['style'][v(-'0x2f5',-'0x2f3')](v(-'0x2fd',-0x303),g+'px');});
    </script>
    </body>
    </html>
<?php
} else {
    header("Location: install.php");
    exit();
}
?>
?>