<?php
include_once("../../../auth.php");
?>
<html>
    <head>
        <title>iwscan report</title>
        <link href="../../../script/tocas/tocas.css" rel='stylesheet'>
        <style>
            .fullscreen{
                width:100%;
                height:100%;
            }
            body{
                padding:10px;
                padding-bottom:30px;
            }
        </style>
    </head>
    <body>
		<?php
			if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
				die('<div class="ts message">
                        <div class="header">Not Supported OS</div>
                        <p>This function is not supported in Windows Host.</p>
                    </div>');
			}
		?>
        <div class="fullscreen ts input">
            <textarea class="fullscreen" readonly>
            <?php
                $content = trim(shell_exec("sudo iw wlan0 scan"));
                if($content == ""){
                    echo "Interface not found or disabled. Please make sure you have wlan0 enabled.";
                }else{
                    echo $content;
                }
            ?>
            </textarea>
        </div>
       
    </body>
</html>