Создание и загрузка ваучервов captiveportal из shell |
|
Автор: Administrator
|
07.11.11 09:35 |
Создание и загрузка ваучервов captiveportal из shell
http://***/services_captiveportal_vouchers.php?act=csv&id=xx xx - номер ролла
вот кусок кода для скрипта
/* print all vouchers of the selected roll */ if ($_GET['act'] == "csv") { $privkey = base64_decode($config['voucher']['privatekey']); if (strstr($privkey,"BEGIN RSA PRIVATE KEY")) { $fd = fopen("{$g['varetc_path']}/voucher.private","w"); if (!$fd) { $input_errors[] = gettext("Cannot write private key file") . ".\n"; } else { chmod("{$g['varetc_path']}/voucher.private", 0600); fwrite($fd, $privkey); fclose($fd); $a_voucher = &$config['voucher']['roll']; $id = $_GET['id']; if (isset($id) && $a_voucher[$id]) { $number = $a_voucher[$id]['number']; $count = $a_voucher[$id]['count']; header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=vouchers_roll$number.csv"); system("/usr/local/bin/voucher -c {$g['varetc_path']}/voucher.cfg -p {$g['varetc_path']}/voucher.private $number $count"); unlink("{$g['varetc_path']}/voucher.private"); exit; } } } else { $input_errors[] = gettext("Need private RSA key to print vouchers") . "\n"; } }
|
/usr/local/bin/voucher -c /ver/etc/voucher.cfg -p var/etc/voucher.private $number $count
|
источник: http://forum.pfsense.org/index.php/topic,42678.0.html
ссылка на материал: http://thin.kiev.ua/index.php?option=com_content&view=article&id=441:-captiveportal-shell&catid=50:pfsense&Itemid=81
|
Последнее обновление 21.03.12 12:10 |