本文整理汇总了PHP中Token::verify方法的典型用法代码示例。如果您正苦于以下问题:PHP Token::verify方法的具体用法?PHP Token::verify怎么用?PHP Token::verify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::verify方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$validate['user'] = array('validation' => 'OSS_USER_2', 'e_message' => 'illegal:' . _('User'));
$validate['pass'] = array('validation' => 'OSS_PASSWORD', 'e_message' => 'illegal:' . _('Password'));
}
if (GET('ajax_validation') == TRUE) {
$data['status'] = 'OK';
$validation_errors = validate_form_fields('GET', $validate);
if (is_array($validation_errors) && !empty($validation_errors)) {
$data['status'] = 'error';
$data['data'] = $validation_errors;
}
echo json_encode($data);
exit;
} else {
//Checking form token
if (!isset($_POST['ajax_validation_all']) || POST('ajax_validation_all') == FALSE) {
if (Token::verify('tk_form_a_deployment', POST('token')) == FALSE) {
Token::show_error();
exit;
}
}
$validation_errors = validate_form_fields('POST', $validate);
//Check Token
if (empty($validation_errors)) {
$db = new ossim_db();
$conn = $db->connect();
$res = Av_center::get_system_info_by_ip($conn, POST('sensor_ip'));
if ($res['status'] == 'success') {
$sensor_id = $res['data']['sensor_id'];
$ossec_server_ip = $res['data']['admin_ip'];
if (!Ossec_utilities::is_sensor_allowed($conn, $sensor_id)) {
$validation_errors['sensor_ip'] = _('Error! Sensor not allowed');
示例2: ossim_clean_error
ossim_clean_error();
}
}
} else {
$validation_errors = validate_form_fields('GET', $validate);
}
if (is_array($validation_errors) && !empty($validation_errors)) {
$data['status'] = 'error';
$data['data'] = $validation_errors;
}
echo json_encode($data);
exit;
}
//Check Token
if (!isset($_POST['ajax_validation_all']) || POST('ajax_validation_all') == FALSE) {
if (!Token::verify('tk_form_server', POST('token'))) {
Token::show_error(_("Action not allowed"));
exit;
}
}
$id = POST('id');
$sname = POST('sname');
$ip = POST('ip');
$port = POST('port');
$descr = POST('descr');
$correlate = POST('correlate') ? 1 : 0;
$cross_correlate = POST('cross_correlate') ? 1 : 0;
$store = POST('store') ? 1 : 0;
$rep = POST('reputation') ? 1 : 0;
$qualify = POST('qualify') ? 1 : 0;
$resend_events = POST('resend_events') ? 1 : 0;
示例3: ossim_valid
//Data related to the action.
ossim_valid($action, OSS_INPUT, 'illegal:' . _("Action"));
if (ossim_error()) {
$response['error'] = TRUE;
$response['msg'] = ossim_get_error();
ossim_clean_error();
echo json_encode($response);
die;
}
//Default values for the response.
$response['error'] = TRUE;
$response['msg'] = _('Unknown Error');
//checking if it is an ajax request
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
//Checking token
if (!Token::verify('tk_plugin_select', GET('token'))) {
$response['error'] = TRUE;
$response['msg'] = _('Invalid Action');
} else {
//List of all the possibles functions
$function_list = array('set_plugins' => array('name' => 'set_plugins', 'params' => array('conn', 'data')), 'vendor_list' => array('name' => 'get_vendor_list', 'params' => array('conn')), 'model_list' => array('name' => 'get_model_list', 'params' => array('conn', 'data')), 'version_list' => array('name' => 'get_version_list', 'params' => array('conn', 'data')), 'plugin_activity' => array('name' => 'plugin_activity', 'params' => array('conn', 'data')));
$_function = $function_list[$action];
//Checking we have a function associated to the action given
if (is_array($_function) && function_exists($_function['name'])) {
$db = new ossim_db();
$conn = $db->connect();
//Now we translate the params list to a real array with the real parameters
$params = array();
foreach ($_function['params'] as $p) {
$params[] = ${$p};
}
示例4: _
$data['data'][$_GET['name']] = _('Password is long enough') . ' [' . _('Maximum password size is') . ' ' . $pass_length_max . ']';
} elseif (!Session::pass_check_complexity($pass)) {
$data['status'] = 'error';
$data['data'][$_GET['name']] = _('Password is not strong enough. Check the password policy configuration for more details');
}
}
break;
}
}
$db->close();
echo json_encode($data);
exit;
}
//Check Token
if (!isset($_POST['ajax_validation_all']) || POST('ajax_validation_all') == FALSE) {
if (!Token::verify('tk_fuser', POST('token'))) {
Token::show_error();
exit;
}
}
$greybox = POST('greybox');
$uuid = POST('uuid');
$login = POST('login');
$user_name = POST('user_name');
$email = POST('email');
$language = POST('language');
$tzone = POST('tzone');
$login_method = POST('login_method');
$c_pass = POST('c_pass');
if (POST('ajax_validation_all') == TRUE) {
$c_pass = utf8_decode($c_pass);
示例5: array
require_once 'av_init.php';
Session::logcheck('configuration-menu', 'PolicyServers');
$validate = array('ip' => array('validation' => 'OSS_IP_ADDR', 'e_message' => 'illegal:' . _('IP address')), 'ri_name' => array('validation' => 'OSS_ALPHA, OSS_DIGIT, OSS_SCORE, OSS_DOT', 'e_message' => 'illegal:' . _('Name')));
if (GET('ajax_validation') == TRUE) {
$data['status'] = 'OK';
$validation_errors = validate_form_fields('GET', $validate);
if (is_array($validation_errors) && !empty($validation_errors)) {
$data['status'] = 'error';
$data['data'] = $validation_errors;
}
echo json_encode($data);
exit;
}
//Check Token
if (!isset($_POST['ajax_validation_all']) || POST('ajax_validation_all') == FALSE) {
if (!Token::verify('tk_form_ri', POST('token'))) {
Token::show_error();
exit;
}
}
$name = POST('ri_name');
$ip = POST('ip');
$status = POST('status') == 1 ? 1 : 0;
$validation_errors = validate_form_fields('POST', $validate);
$data['status'] = 'OK';
$data['data'] = $validation_errors;
if (POST('ajax_validation_all') == TRUE) {
if (is_array($validation_errors) && !empty($validation_errors)) {
$data['status'] = 'error';
echo json_encode($data);
} else {
示例6: ossim_db
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
require_once 'languages.inc';
Session::useractive('../session/login.php');
$conf = $GLOBALS['CONF'];
/* Connect to db */
$db = new ossim_db();
$conn = $db->connect();
// Expire session
$action = REQUEST('action');
if ($action == 'expire_session') {
if (!Token::verify('tk_f_users', GET('token'))) {
Token::show_error();
exit;
}
if (Session::userAllowed($user_id) > 1) {
Session_activity::expire_my_others_sessions($conn, $user_id);
}
}
/* Version */
$pro = Session::is_pro();
//Timezone
$tzlist = timezone_identifiers_list(4095);
sort($tzlist);
//Login method list
$lm_list = array('ldap' => _('LDAP'), 'pass' => _('PASSWORD'));
//Entities and Templates
示例7: POST
Session::logcheck_ajax('environment-menu', 'PolicyNetworks');
} else {
Util::response_bad_request(_('Invalid asset type value'));
}
}
//Validate action type
$action = POST('action');
ossim_valid($action, OSS_LETTER, '_', 'illegal:' . _('Action'));
if (ossim_error()) {
$error = ossim_get_error_clean();
Util::response_bad_request($error);
}
//Validate Form token
$token = POST('token');
$tk_key = 'tk_' . $action;
if (Token::verify($tk_key, $token) == FALSE) {
$error = Token::create_error_message();
Util::response_bad_request($error);
}
$db = new ossim_db();
$conn = $db->connect();
try {
$response = array();
switch ($action) {
case 'add_note':
$response = add_note($conn, $type);
break;
case 'edit_note':
$response = edit_note($conn);
break;
case 'delete_note':
示例8: sprintf
if ($frequency < 1800) {
$data['status'] = 'error';
$validation_errors[$_GET['name']] = sprintf(_('Invalid time between scans') . '. <br/>' . _('Entered value') . ": '<strong>%s</strong>' (1800(s) " . _('minimum') . ")", Util::htmlentities($frequency));
}
}
}
echo json_encode($data);
exit;
}
/****************************************************
**************** Checking all fields ****************
*****************************************************/
//Checking form token
if (!isset($_POST['ajax_validation_all']) || POST('ajax_validation_all') == FALSE) {
$token = POST('token');
if (Token::verify('tk_ss_form', $token) == FALSE) {
Token::show_error();
exit;
}
}
$s_type = POST('s_type');
$task_id = intval(POST('task_id'));
$name = POST('task_name');
$sensor_id = POST('task_sensor');
$params = POST('task_params');
$frequency = POST('task_period');
$validation_errors = validate_form_fields('POST', $validate);
//Extra validations
if (empty($validation_errors)) {
switch ($s_type) {
case 'nmap':
示例9: ossim_get_error
if (ossim_error()) {
$response['error'] = TRUE;
$response['msg'] = ossim_get_error();
ossim_clean_error();
echo json_encode($response);
die;
}
$db = new ossim_db(TRUE);
$conn = $db->connect();
//Default values for the response.
$response['error'] = TRUE;
$response['msg'] = _('Error');
//checking if it is an ajax request
if ($action != '' && isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
//Checking token
if (!Token::verify('tk_asset_filter_list', GET('token'))) {
$response['error'] = TRUE;
$response['msg'] = _('Invalid Action');
} else {
$function_list = array('network' => 'network_list', 'software' => 'software_list', 'sensor' => 'sensor_list', 'device_type' => 'device_type_list', 'service' => 'service_list', 'location' => 'location_list', 'operating_system' => 'operating_system_list', 'group' => 'group_list', 'model' => 'model_list', 'label' => 'label_list', 'plugin' => 'plugin_list');
try {
$func_name = $function_list[$action];
if (function_exists($func_name)) {
$response = $func_name($conn, $page, $search);
} else {
$response['error'] = TRUE;
$response['msg'] = _('Wrong Option Chosen');
}
} catch (Exception $e) {
$response['error'] = TRUE;
$response['msg'] = $e->getMessage();
示例10: _
Util::memcacheFlush(false);
$return['error'] = false;
$return['data'] = _('Device Property Modified Successfully');
}
return $return;
}
$action = POST("action");
$data = POST("data");
ossim_valid($action, OSS_DIGIT, 'illegal:' . _("Action"));
if (ossim_error()) {
die(ossim_error());
}
$db = new ossim_db(TRUE);
$conn = $db->connect();
if ($action != '' && isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
if (!Token::verify('tk_deploy_ajax', GET('token'))) {
$response['error'] = true;
$response['msg'] = 'Invalid Action';
echo json_encode($response);
$db->close();
exit;
}
switch ($action) {
case 1:
$response = get_network_status($conn, $data);
break;
case 2:
$response = modify_location_services($conn, $data);
break;
case 3:
$response = get_assets_visibility($conn);
示例11: utf8_decode
*
*/
//Config File
require_once 'av_init.php';
Session::logcheck('environment-menu', 'PolicyHosts');
$search = utf8_decode(POST('search'));
ossim_valid($search, OSS_NOECHARS, OSS_ALPHA, OSS_PUNC, OSS_NULLABLE, 'illegal: search');
if (ossim_error()) {
$data['status'] = 'error';
$data['data'] = $GLOBALS['ossim_last_error'];
echo json_encode($data);
exit;
}
//Validate Form token
$token = POST('token');
if (Token::verify('tk_delete_all', $token) == FALSE) {
$data['status'] = 'error';
$data['data'] = Token::create_error_message();
echo json_encode($data);
exit;
}
session_write_close();
/* connect to db */
$db = new ossim_db(TRUE);
$conn = $db->connect();
try {
$filters = array();
if ($search != '') {
$search = escape_sql($search, $conn);
$filters['where'] = " g.name LIKE '%{$search}%' OR g.owner LIKE '%{$search}%'";
}
示例12: _
*
* You should have received a copy of the GNU General Public License
* along with this package; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA 02110-1301 USA
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
Session::logcheck("configuration-menu", "PolicyPolicy");
if (!Token::verify('tk_delete_policy', GET('token'))) {
echo "Action not allowed";
exit;
}
?>
<html>
<head>
<title> <?php
echo _("OSSIM Framework");
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<link rel="stylesheet" type="text/css" href="../style/av_common.css?t=<?php
示例13: _
if ($launch_status > 0) {
$response['status'] = 'success';
$response['message'] = _('The backup process is inserting events...');
} else {
$response['status'] = 'error';
$response['message'] = _('Sorry, operation was not completed due to an error when restoring events');
}
} else {
$response['status'] = 'error';
$response['message'] = _('Please, select the dates you want to restore');
}
break;
// Purge button
// Purge button
case 'delete':
if (Token::verify('tk_delete_events', GET('token')) == FALSE) {
$response['status'] = 'error';
$response['message'] = Token::create_error_message();
} elseif (count($dates_list) > 0) {
$launch_status = Backup::Delete($dates_list);
if ($launch_status > 0) {
$response['status'] = 'success';
$response['message'] = _('The backup process is purging events...');
} else {
$response['status'] = 'error';
$response['message'] = _('Sorry, operation was not completed due to an error when purging events');
}
} else {
$response['status'] = 'error';
$response['message'] = _('Please, select the dates you want to purge');
}
示例14: POST
// Get action type
$action = POST('action');
// Validate action type
ossim_valid($action, OSS_LETTER, '_', 'illegal:' . _('Action'));
if (ossim_error()) {
Util::response_bad_request(ossim_get_error_clean());
}
// Database access object
$db = new Ossim_db();
$conn = $db->connect();
switch ($action) {
case 'track_usage_information':
try {
//Validate Token
$token = POST('token');
if (Token::verify('tk_tui', $token) == FALSE) {
$t_error = Token::create_error_message();
Av_exception::throw_error(Av_exception::USER_ERROR, $t_error);
}
if (Session::am_i_admin()) {
$tui = intval(POST('tui'));
$tui_status = $tui > 0 ? 1 : 0;
$config = new Config();
$config->update('track_usage_information', $tui_status);
$client = new Alienvault_client();
$tui_status = $tui > 0 ? TRUE : FALSE;
$client->system()->set_telemetry($tui_status);
$data['status'] = 'success';
$data['data'] = _('Your changes have been saved');
} else {
Av_exception::throw_error(Av_exception::USER_ERROR, _('You do not have the correct permissions to configure this option. Please contact system administrator with any questions'));
示例15: POST
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA 02110-1301 USA
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
//Config File
require_once 'av_init.php';
Session::logcheck_ajax('environment-menu', 'PolicyHosts');
//Validate Form token
$token = POST('token');
if (Token::verify('tk_delete_asset_bulk', $token) == FALSE) {
$error = Token::create_error_message();
Util::response_bad_request($error);
}
session_write_close();
/* connect to db */
$db = new ossim_db(TRUE);
$conn = $db->connect();
try {
$perm_add = Session::can_i_create_assets();
if (!$perm_add) {
$db->close();
$error = _('You do not have the correct permissions to delete assets. Please contact system administrator with any questions');
Util::response_bad_request($error);
}
$app_name = Session::is_pro() ? 'AlienVault' : 'OSSIM';