Пример #1
0
<?php

require '../classes/adminauth.php';
require '../classes/systemmanager.php';
$a = new adminauth();
$s = new systemmanager();
if (!$a->CheckPermission('sys_config')) {
    require '../classes/gui.php';
    include '../includes/header.php';
    include 'menu.php';
    echo '<center><b>You have no permission to manage the system config.</b></center></body></html>';
    die;
}
include '../includes/header.php';
include 'menu.php';
echo '<center><b>Manage system config</b></center><br><br>';
if ($_GET['do'] == 'update_general') {
    $s->SetSetting('vouchertext1', $_POST['vouchertext1']);
    $s->SetSetting('vouchertext2', $_POST['vouchertext2']);
    $s->SetSetting('pre-form-text', $_POST['pre-form-text']);
    $s->SetSetting('post-form-text', $_POST['post-form-text']);
    $s->SetSetting('deny_drop_devices', $_POST['deny_drop_devices']);
    if ($_POST['use_verification'] == 'y') {
        $s->SetSetting('use_verification', 'y');
    } else {
        $s->SetSetting('use_verification', 'n');
    }
    if ($_POST['use_exp_date'] == 'y') {
        $s->SetSetting('use_exp_date', 'y');
    } else {
        $s->SetSetting('use_exp_date', 'n');
Пример #2
0
<?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';
Пример #3
0
<?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>
Пример #4
0
<?php

if (!class_exists('systemmanager')) {
    require '../classes/systemmanager.php';
}
if (!isset($s)) {
    $s = new systemmanager();
}
$logo = $s->GetSetting('logo');
if (file_exists('../graphics/' . $logo) && !is_dir('../graphics/' . $logo)) {
    $img_inc = '../graphics/' . $logo;
} else {
    $img_inc = '../graphics/logo-small.png';
}
?>
<html>
<head>
<link rel="stylesheet" href="../style/style.css">
<script language="javascript" src="functions.js"></script>
<title>OpenVoucher</title>
</head>
<body>
<table width="100%" border="0" cellspacing="0">
<tr class="tableheader">
<td colspan="3">&nbsp;</td>
</tr><tr>
<td><img src="<?php 
echo $img_inc;
?>
"></td>
<td align="center">
Пример #5
0
<?php

require '../classes/adminauth.php';
require '../classes/systemmanager.php';
$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';
        }
    }
Пример #6
0
<?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>