示例#1
0
<?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');
示例#2
0
<?php

require '../classes/adminauth.php';
$a = new adminauth();
if (!$a->CheckPermission('drop_voucher')) {
    require '../classes/gui.php';
    $agui = new admingui();
    include '../includes/header.php';
    include 'menu.php';
    echo '<center><b>You have no permission to drop vouchers.</b></center></body></html>';
    die;
}
require '../classes/vouchermanager.php';
$v = new vouchermanager();
$v->DropVoucher($_GET['vid'], true);
header('Location: index.php');
示例#3
0
文件: auth.php 项目: lavvy/openv
<?php

require '../classes/vouchermanager.php';
require '../classes/systemmanager.php';
$v = new vouchermanager();
$s = new systemmanager();
$authtype = $v->GetAuthMethod();
if ($authtype == 'mac-only') {
    // MAC
    $mac = $v->GetClientMAC();
    if ($mac != '') {
        $res = $v->AuthDevice($_POST['vid'], $_POST['verification_key'], 'mac', $mac);
        if ($res != 'ok') {
            $auth_error = $res;
        }
    } else {
        $auth_error = 'no-mac';
    }
} elseif ($authtype == 'mac-ipv4') {
    // TODO MAC and IP4v fallback
} elseif ($authtype == 'ipv4-only') {
    // IPv4 only
    $res = $v->AuthDevice($_POST['vid'], $_POST['verification_key'], 'ipv4', $_SERVER['REMOTE_ADDR']);
    if ($res != 'ok') {
        $auth_error = $res;
    }
} else {
    $auth_error = 'no-auth-method';
}
if ($auth_error != '') {
    include '../includes/header.php';
示例#4
0
文件: index.php 项目: lavvy/openv
<?php

require '../classes/adminauth.php';
require '../classes/vouchermanager.php';
require '../classes/gui.php';
$a = new adminauth();
$v = new vouchermanager();
$agui = new admingui();
include '../includes/header.php';
include 'menu.php';
echo '<center><b>Active vouchers:</b></center><br>';
// List all vouchers
if ($a->CheckPermission('view_voucher')) {
    $agui->ListVouchers($v->GetVoucherList());
} else {
    echo '<center><i>You are now allowed to view vouchers.</i></center>';
}
?>
</body>
</html>
示例#5
0
文件: index.php 项目: lavvy/openv
<?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>
示例#6
0
<?php

chdir('/var/www/localscripts/');
// Edit this path if needed
// Don't edit below!
include '../classes/vouchermanager.php';
$v = new vouchermanager();
$v->DropOldVouchers();
示例#7
0
$a = new adminauth();
$s = new systemmanager();
if (!$a->CheckPermission('add_voucher')) {
    require '../classes/gui.php';
    include '../includes/header.php';
    include 'menu.php';
    echo '<center><b>You have no permission to add vouchers.</b></center></body></html>';
    die;
}
include '../includes/header.php';
include 'menu.php';
// Has a number been entered or do we have to display the form? Has the user set how long the voucher should be valid?
if (is_numeric($_POST['cnt']) && trim($_POST['cnt']) != '' && ($_POST['d'] != 0 || $_POST['h'] != 0 || $_POST['m'] != 0 || ($_POST['e_d'] != 0 || $_POST['e_h'] != 0 || $_POST['e_m'] != 0)) && ($_POST['start_expire'] != '' || $s->GetSetting('force_start_exp') == 'y')) {
    // Include and load the vouchermanager
    require '../classes/vouchermanager.php';
    $v = new vouchermanager();
    // Replace entered values with default values, if enforced. This prevents the user from injecting forbidden values to the system
    if ($s->GetSetting('force_device-qty') == 'y') {
        $_POST['dev-cnt'] = $s->GetSetting('default_device-qty');
    }
    if ($s->GetSetting('force_start_exp') == 'y') {
        if ($s->GetSetting('default_start_exp') == 'creation') {
            $_POST['start_expire'] = 'now';
        } else {
            $_POST['start_expire'] = 'given';
        }
    }
    if ($s->GetSetting('force_exp') == 'y') {
        $_POST['d'] = $s->GetSetting('default_exp_d');
        $_POST['e_d'] = $_POST['d'];
        $_POST['h'] = $s->GetSetting('default_exp_h');
示例#8
0
文件: drop.php 项目: lavvy/openv
<?php

require '../classes/vouchermanager.php';
require '../classes/systemmanager.php';
$v = new vouchermanager();
$s = new systemmanager();
$authtype = $v->GetAuthMethod();
require '../includes/header.php';
if ($s->GetSetting('deny_drop_devices') == 'y') {
    die('Sorry, dropping devices has been disabled by the admin.');
}
if ($_GET['do'] == '') {
    echo 'To drop a device, please enter your voucher code again:<br><br>
	<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>