<?php require '../classes/adminauth.php'; $a = new adminauth(); if (!$a->CheckPermission('drop_device')) { require '../classes/gui.php'; $agui = new admingui(); include '../includes/header.php'; include 'menu.php'; echo '<center><b>You have no permission to drop devices.</b></center></body></html>'; die; } require '../classes/vouchermanager.php'; $v = new vouchermanager(); $v->DropDevice($_GET['type'], $_GET['addr']); header('Location: index.php');
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'])) { echo 'Couldn\'t get device.</body></html>'; die; } $v->DropDevice($_GET['type'], $_GET['device']); echo 'The device has been dropped. You can now go <a href="index.php">back</a> and login with your voucher.'; } ?> </body> </html>