<?php header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); require '../classes/vouchermanager.php'; require '../classes/systemmanager.php'; $v = new vouchermanager(); $clientdata = $v->ClientAuthenticated(); $s = new systemmanager(); require '../includes/header.php'; // Must be included after creating instance of systemmanager if ($clientdata != 'noauth') { echo 'You are online and can now browse the internet.<br><br> Your voucher ID is: ' . $clientdata[2] . '<br>'; $vinfo = $v->GetVoucherInfo($clientdata[2]); echo 'Your voucher is valid until ' . date('Y-m-d H:i', $vinfo['valid_until']) . ' and you can register ' . $vinfo['remain'] . ' more device(s) with this voucher.'; } else { echo $s->GetSetting('pre-form-text') . '<br><br> <form action="auth.php" method="post"> Voucher code: <input type="text" name="vid" size="20" class="formstyle">'; if ($s->GetSetting('use_verification') == 'y') { echo '<br>Verification key: <input type="text" name="verification_key" size="20" class="formstyle">'; } echo '<br><br> <input type="submit" value="OK" class="formstyle"> </form><br><br>' . $s->GetSetting('post-form-text'); } ?> </body> </html>
<form action="drop.php?do=lst-devices" method="post"> Voucher code: <input type="text" name="vid" size="20" class="formstyle">'; if ($s->GetSetting('use_verification') == 'y') { echo '<br>Verification key: <input type="text" name="verification_key" size="20" class="formstyle">'; } echo '<br><br> <input type="submit" value="Next" class="formstyle">'; } if ($_GET['do'] == 'lst-devices') { if ($s->GetSetting('use_verification') == 'y') { if (!$v->VerifyVoucherKey($_POST['vid'], $_POST['verification_key'])) { echo 'The verification key is invalid. Please go <a href="javascript:history.back();">back</a> and try again.</body></html>'; die; } } $voucher_info = $v->GetVoucherInfo($_POST['vid']); $devices = $v->GetDeviceList($_POST['vid']); echo 'Device count: ' . $voucher_info['dev_count'] . ' (' . $voucher_info['remain'] . ' left)<br> Valid until: ' . date('Y-m-d H:i', $voucher_info['valid_until']) . '<br><br>Choose one of these devices to drop:<br>'; foreach ($devices as $device) { echo '<ul><a href="' . $_SERVER['PHP_SELF'] . '?do=drop&vid=' . $_POST['vid'] . '&verification_key=' . $_POST['verification_key'] . '&device=' . $device['addr'] . '&type=' . $device['type'] . '">' . $device['addr'] . '</a></ul>'; } } if ($_GET['do'] == 'drop') { if ($s->GetSetting('use_verification') == 'y') { if (!$v->VerifyVoucherKey($_GET['vid'], $_GET['verification_key'])) { echo 'The verification key is invalid. Please go <a href="' . $_SERVER['PHP_SELF'] . '">back</a> and try again.</body></html>'; die; } } if (!isset($_GET['device'])) {