本文整理匯總了PHP中print_success函數的典型用法代碼示例。如果您正苦於以下問題:PHP print_success函數的具體用法?PHP print_success怎麽用?PHP print_success使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了print_success函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: exec_ogp_module
function exec_ogp_module()
{
global $db;
global $view;
$user_id = $_GET['user_id'];
$y = isset($_GET['y']) ? $_GET['y'] : "";
$user = $db->getUserById($user_id);
if (empty($user)) {
print_failure(get_lang_f('user_with_id_does_not_exist', $user_id));
return;
}
$username = $user['users_login'];
if ($y !== 'y') {
if (!$db->isModuleInstalled("subusers")) {
echo "<p>" . get_lang_f('are_you_sure_you_want_to_delete_user', $username) . "</p>";
} else {
if (!$db->isSubUser($user_id)) {
echo "<p>" . get_lang_f('are_you_sure_you_want_to_delete_user', $username) . get_lang('andSubUsers') . "</p>";
} else {
echo "<p>" . get_lang_f('are_you_sure_you_want_to_delete_user', $username) . "</p>";
}
}
echo "<p><a href=\"?m=user_admin&p=del&user_id={$user_id}&y=y\">" . get_lang('yes') . "</a> <a href=\"?m=user_admin\">" . get_lang('no') . "</a></p>";
return;
}
if (!$db->delUser($user_id)) {
print_failure(get_lang_f('unable_to_delete_user', $username));
$view->refresh("?m=user_admin");
return;
}
print_success(get_lang_f('successfully_deleted_user', $username));
$db->logger(get_lang_f('successfully_deleted_user', $username));
$view->refresh("?m=user_admin");
}
示例2: exec_ogp_module
function exec_ogp_module()
{
global $view;
global $db;
#This will add a remote host to the list
if (isset($_REQUEST['add_remote_host'])) {
$rhost_ip = trim($_POST['remote_host']);
$rhost_name = trim($_POST['remote_host_name']);
$rhost_user_name = trim($_POST['remote_host_user_name']);
$rhost_port = trim($_POST['remote_host_port']);
$rhost_ftp_ip = trim($_POST['remote_host_ftp_ip']);
$rhost_ftp_port = trim($_POST['remote_host_ftp_port']);
$encryption_key = trim($_POST['remote_encryption_key']);
$timeout = trim($_POST['timeout']);
$use_nat = trim($_POST['use_nat']);
if (empty($rhost_ip)) {
print_failure(get_lang('enter_ip_host'));
$view->refresh("?m=server");
return;
}
if (empty($rhost_user_name)) {
print_failure(get_lang('enter_unix_user_name'));
$view->refresh("?m=server");
return;
}
if (!isPortValid($rhost_port)) {
print_failure(get_lang('enter_valid_ip'));
$view->refresh("?m=server");
return;
}
$rhost_id = $db->addRemoteServer($rhost_ip, $rhost_name, $rhost_user_name, $rhost_port, $rhost_ftp_ip, $rhost_ftp_port, $encryption_key, $timeout, $use_nat);
if (!$rhost_id) {
print_failure("" . get_lang('could_not_add_server') . " " . $rhost_ip . " " . get_lang('to_db') . "");
$view->refresh("?m=server");
return;
}
print_success("" . get_lang('added_server') . " {$rhost_ip} " . get_lang('with_port') . " {$rhost_port} " . get_lang('to_db_succesfully') . "");
require_once 'includes/lib_remote.php';
$remote = new OGPRemoteLibrary($rhost_ip, $rhost_port, $encryption_key);
$iplist = $remote->discover_ips();
if (empty($iplist)) {
print_failure("" . get_lang('unable_discover') . " " . $rhost_ip . ". " . get_lang('set_ip_manually') . "");
} else {
print_success("" . get_lang('found_ips') . " (" . implode(",", $iplist) . ") " . get_lang('for_remote_server') . "");
foreach ($iplist as $remote_ip) {
$remote_ip = trim($remote_ip);
if (empty($remote_ip)) {
continue;
}
if (!$db->addRemoteServerIp($rhost_id, $remote_ip)) {
print_failure("" . get_lang('failed_add_ip') . " (" . $remote_ip . ") " . get_lang('for_remote_server') . "");
}
}
}
$view->refresh("?m=server");
return;
}
}
示例3: exec_ogp_module
function exec_ogp_module()
{
global $db;
global $view;
print "<h2>" . get_lang_f('uninstalling_module', $_REQUEST['module']) . "</h2>";
require_once 'modules/modulemanager/module_handling.php';
if (isset($_REQUEST['id']) && isset($_REQUEST['module']) && uninstall_module($db, $_REQUEST['id'], $_REQUEST['module']) === TRUE) {
print_success(get_lang_f("successfully_uninstalled_module", $_REQUEST['module']));
} else {
print_failure(get_lang_f("failed_to_uninstall_module", $_REQUEST['module']));
}
$view->refresh("?m=modulemanager");
}
示例4: exec_ogp_module
function exec_ogp_module()
{
require_once 'modules/settings/functions.php';
require_once 'includes/form_table_class.php';
global $db, $view, $settings;
if (isset($_REQUEST['update_settings'])) {
$settings = array("theme" => $_REQUEST['theme'], "welcome_title" => $_REQUEST['welcome_title'], "welcome_title_message" => $_REQUEST['welcome_title_message'], "logo_link" => $_REQUEST['logo_link'], "bg_wrapper" => @$_REQUEST['bg_wrapper'], "custom_tab" => $_REQUEST['custom_tab'], "custom_tab_name" => @$_REQUEST['custom_tab_name'], "custom_tab_link" => @$_REQUEST['custom_tab_link'], "custom_tab_sub" => @$_REQUEST['custom_tab_sub'], "custom_tab_sub_name" => @$_REQUEST['custom_tab_sub_name'], "custom_tab_sub_link" => @$_REQUEST['custom_tab_sub_link'], "custom_tab_sub_name2" => @$_REQUEST['custom_tab_sub_name2'], "custom_tab_sub_link2" => @$_REQUEST['custom_tab_sub_link2'], "custom_tab_sub_name3" => @$_REQUEST['custom_tab_sub_name3'], "custom_tab_sub_link3" => @$_REQUEST['custom_tab_sub_link3'], "custom_tab_sub_name4" => @$_REQUEST['custom_tab_sub_name4'], "custom_tab_sub_link4" => @$_REQUEST['custom_tab_sub_link4'], "custom_tab_target_blank" => @$_REQUEST['custom_tab_target_blank']);
$db->setSettings($settings);
print_success(get_lang('settings_updated'));
$view->refresh("?m=settings&p=themes");
return;
}
echo "<h2>" . get_lang('theme_settings') . "</h2>";
$row = $db->getSettings();
$ft = new FormTable();
$ft->start_form("?m=settings&p=themes");
$ft->start_table();
$ft->add_custom_field('theme', get_theme_html_str(@$row['theme']));
$ft->add_field('on_off', 'welcome_title', @$row['welcome_title']);
$ft->add_field('text', 'welcome_title_message', @$row['welcome_title_message']);
$ft->add_field('string', 'logo_link', @$row['logo_link']);
if ($settings['theme'] == "Revolution" or "Soft") {
$ft->add_field('bg_wrapper', 'bg_wrapper', @$row['bg_wrapper']);
}
$ft->add_field('on_off', 'custom_tab', @$row['custom_tab']);
if (isset($settings['custom_tab']) && $settings['custom_tab'] == "1") {
$ft->add_field('string', 'custom_tab_name', @$row['custom_tab_name']);
$ft->add_field('string', 'custom_tab_link', @$row['custom_tab_link']);
$ft->add_field('on_off', 'custom_tab_sub', @$row['custom_tab_sub']);
if (isset($settings['custom_tab_sub']) && $settings['custom_tab_sub'] == "1") {
$ft->add_field('string', 'custom_tab_sub_name', @$row['custom_tab_sub_name']);
$ft->add_field('string', 'custom_tab_sub_link', @$row['custom_tab_sub_link']);
$ft->add_field('string', 'custom_tab_sub_name2', @$row['custom_tab_sub_name2']);
$ft->add_field('string', 'custom_tab_sub_link2', @$row['custom_tab_sub_link2']);
$ft->add_field('string', 'custom_tab_sub_name3', @$row['custom_tab_sub_name3']);
$ft->add_field('string', 'custom_tab_sub_link3', @$row['custom_tab_sub_link3']);
$ft->add_field('string', 'custom_tab_sub_name4', @$row['custom_tab_sub_name4']);
$ft->add_field('string', 'custom_tab_sub_link4', @$row['custom_tab_sub_link4']);
}
$ft->add_field('target_self_blank', 'custom_tab_target_blank', @$row['custom_tab_target_blank']);
}
$ft->end_table();
$ft->add_button("submit", "update_settings", get_lang('update_settings'));
$ft->end_form();
}
示例5: exec_ogp_module
function exec_ogp_module()
{
global $db;
global $view;
if (isset($_POST['add_group'])) {
$group = trim($_POST['group_name']);
if (empty($group)) {
print_failure(get_lang('group_name_empty'));
return;
}
if (!$db->addGroup($group, $_SESSION['user_id'])) {
print_failure(get_lang_f("failed_to_add_group", $group));
$view->refresh("?m=user_admin&p=show_groups");
return;
}
print_success(get_lang_f('successfully_added_group', $group));
$db->logger(get_lang_f('successfully_added_group', $group));
$view->refresh("?m=user_admin&p=show_groups");
}
}
示例6: exec_ogp_module
function exec_ogp_module()
{
global $view;
global $db;
echo "<h2>" . get_lang('view_log') . "</h2>";
$rhost_id = @$_REQUEST['rhost_id'];
$remote_server = $db->getRemoteServer($rhost_id);
$remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key']);
if (isset($_POST['save_file'])) {
$file_info = $remote->remote_writefile('./ogp_agent.log', $_REQUEST['file_content']);
if ($file_info === 1) {
print_success(get_lang('wrote_changes'));
} else {
if ($file_info === 0) {
print_failure(get_lang('failed_write'));
} else {
print_failure(get_lang("agent_offline"));
}
}
}
$data = "";
$file_info = $remote->remote_readfile('./ogp_agent.log', $data);
if ($file_info === 0) {
print_failure(get_lang("not_found"));
return;
} else {
if ($file_info === -1) {
print_failure(get_lang("agent_offline"));
return;
} else {
if ($file_info === -2) {
print_failure(get_lang("failed_read"));
return;
}
}
}
echo "<form action='?m=server&p=log&rhost_id=" . $rhost_id . "' method='post'>";
echo "<textarea name='file_content' style='width:98%;' rows='40'>{$data}</textarea>";
echo "<p><input type='submit' name='save_file' value='Save' /></p>";
echo "</form>";
}
示例7: exec_ogp_module
function exec_ogp_module()
{
global $db;
global $view;
print "<h2>" . get_lang_f('installing_module', $_REQUEST['module']) . "</h2>";
require_once 'modules/modulemanager/module_handling.php';
$install_retval = -99;
if (isset($_REQUEST['module'])) {
$install_retval = install_module($db, $_REQUEST['module']);
}
if ($install_retval > 0) {
print_success(get_lang_f("successfully_installed_module", $_REQUEST['module']));
} else {
if ($install_retval == 0) {
print_success(get_lang_f("module_already_installed", $_REQUEST['module']));
} else {
print_failure(get_lang_f("failed_to_install_module", $_REQUEST['module']));
}
}
$view->refresh("?m=modulemanager");
}
示例8: exec_ogp_module
function exec_ogp_module()
{
global $db;
global $view;
$group_id = $_GET['group_id'];
if (!$db->isAdmin($_SESSION['user_id'])) {
$result = $db->getUserGroupList($_SESSION['user_id']);
foreach ($result as $row) {
if ($row['group_id'] == $group_id) {
$own_group = TRUE;
}
}
}
if (!$db->isAdmin($_SESSION['user_id']) && !isset($own_group)) {
echo "<p class='note'>" . get_lang('not_available') . "</p>";
return;
}
$y = isset($_GET['y']) ? $_GET['y'] : "";
$group = $db->getGroupById($group_id);
if (empty($group)) {
print_failure(get_lang_f('group_with_id_does_not_exist', $group_id));
return;
}
$groupname = $group['group_name'];
if ($y !== 'y') {
echo "<p>" . get_lang_f('are_you_sure_you_want_to_delete_group', $groupname) . "</p>";
echo "<p><a href=\"?m=user_admin&p=del_group&group_id={$group_id}&y=y\">" . get_lang('yes') . "</a> <a href=\"?m=user_admin&p=show_groups\">" . get_lang('no') . "</a></p>";
return;
}
if (!$db->delGroup($group_id)) {
print_failure(get_lang_f('unable_to_delete_group', $groupname));
$view->refresh("?m=user_admin&p=show_groups");
return;
}
print_success(get_lang_f('successfully_deleted_group', $groupname));
$db->logger(get_lang_f('successfully_deleted_group', $groupname));
$view->refresh("?m=user_admin&p=show_groups");
}
示例9: exec_ogp_module
function exec_ogp_module()
{
$home_id = $_REQUEST['home_id'];
if (empty($home_id)) {
print_failure(get_lang('home_id_missing'));
return;
}
global $db;
$isAdmin = $db->isAdmin($_SESSION['user_id']);
if ($isAdmin) {
$home_cfg = $db->getGameHome($home_id);
} else {
$home_cfg = $db->getUserGameHome($_SESSION['user_id'], $home_id);
}
if ($home_cfg === FALSE) {
print_failure(get_lang('no_access_to_home'));
return;
}
if (isset($_REQUEST['save_file'])) {
// If magic quotes are on then we need to remove those slashes here.
if (get_magic_quotes_gpc()) {
$_REQUEST['file_content'] = stripslashes($_REQUEST['file_content']);
}
$remote = new OGPRemoteLibrary($home_cfg['agent_ip'], $home_cfg['agent_port'], $home_cfg['encryption_key']);
$file_info = $remote->remote_writefile($home_cfg['home_path'] . "/" . $_SESSION['fm_cwd_' . $home_id], $_REQUEST['file_content']);
if ($file_info === 1) {
print_success(get_lang('wrote_changes'));
$db->logger(get_lang('wrote_changes') . " ( " . $home_cfg['home_name'] . " - " . $home_cfg['home_path'] . $_SESSION['fm_cwd_' . $home_id] . " )");
} else {
if ($file_info === 0) {
print_failure(get_lang('failed_write'));
} else {
print_failure(get_lang("agent_offline"));
}
}
}
echo "<table class='center' style='width:100%;'>" . show_back($home_id) . "</table>";
}
示例10: exec_ogp_module
<script src="modules/addonsmanager/jquery-ui.js"></script>
<script>
$(function() {
$( 'input,textarea' ).tooltip();
});
</script>
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) Copyright (C) 2008 - 2013 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
function exec_ogp_module()
{
global $db;
if (isset($_POST['create_addon']) and isset($_POST['name']) and $_POST['url'] == "") {
print_failure(get_lang("fill_the_url_address_to_a_compressed_file"));
} elseif (isset($_POST['create_addon']) and isset($_POST['url']) and $_POST['name'] == "") {
print_failure(get_lang("fill_the_addon_name"));
} elseif (isset($_POST['create_addon']) and isset($_POST['name']) and isset($_POST['url']) and empty($_POST['addon_type'])) {
print_failure(get_lang("select_an_addon_type"));
} elseif (isset($_POST['create_addon']) and isset($_POST['name']) and isset($_POST['url']) and isset($_POST['addon_type']) and empty($_POST['home_cfg_id'])) {
print_failure(get_lang("select_a_game_type"));
} elseif (isset($_POST['create_addon']) and isset($_POST['name']) and isset($_POST['url']) and isset($_POST['addon_type']) and isset($_POST['home_cfg_id'])) {
$fields['name'] = $_POST['name'];
$fields['url'] = $_POST['url'];
$fields['path'] = $_POST['path'];
$fields['addon_type'] = $_POST['addon_type'];
$fields['home_cfg_id'] = $_POST['home_cfg_id'];
$fields['post_script'] = $_POST['post_script'];
if (is_numeric($db->resultInsertId('addons', $fields))) {
print_success(get_lang_f("addon_has_been_created", $_POST['name']));
if (isset($_POST['addon_id']) && isset($_POST['edit'])) {
$db->query("DELETE FROM OGP_DB_PREFIXaddons WHERE addon_id=" . $_POST['addon_id']);
}
}
}
echo "<h2>" . get_lang('addons_manager') . "</h2>";
$name = isset($_POST['name']) ? $_POST['name'] : "";
$url = isset($_POST['url']) ? $_POST['url'] : "";
$path = isset($_POST['path']) ? $_POST['path'] : "";
$post_script = isset($_POST['post_script']) ? $_POST['post_script'] : "";
$home_cfg_id = isset($_POST['home_cfg_id']) ? $_POST['home_cfg_id'] : "";
$addon_type = isset($_POST['addon_type']) ? $_POST['addon_type'] : "";
if (isset($_POST['addon_id']) && isset($_POST['edit'])) {
$addons_rows = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXaddons WHERE addon_id=" . $_POST['addon_id']);
$addon_info = $addons_rows[0];
$name = isset($addon_info['name']) ? $addon_info['name'] : "";
$url = isset($addon_info['url']) ? $addon_info['url'] : "";
$path = isset($addon_info['path']) ? $addon_info['path'] : "";
$post_script = isset($addon_info['post_script']) ? $addon_info['post_script'] : "";
$home_cfg_id = isset($addon_info['home_cfg_id']) ? $addon_info['home_cfg_id'] : "";
$addon_type = isset($addon_info['addon_type']) ? $addon_info['addon_type'] : "";
}
?>
<form action="" method="post">
<table class="center">
<tr>
<td align="right">
<b><?php
print_lang('addon_name');
?>
</b>
</td>
<td align="left">
<input type="text" value="<?php
echo $name;
?>
" name="name" size="90" title="<?php
print_lang('addon_name_info');
?>
" />
</td>
</tr>
<tr>
<td align="right">
<b><?php
print_lang('url');
?>
</b>
</td>
<td align="left">
<input type="text" value="<?php
//.........這裏部分代碼省略.........
示例11: print_success
<div class="row">
<div class="col-sm-4">
<ol class="breadcrumb bc-3">
<li> <a href="admin.php?act=dashboard"><i class="entypo-home"></i>Dashboard</a> </li>
<li> <a href="admin.php?act=apiauthentications"><i></i>Manage Authentication Keys</a> </li>
<li class="active"> <strong>API Authentications</strong> </li>
</ol>
</div>
</div>
<h2>Add Keys</h2>
<div class="clearfix"></div>
<br />
<?php
print_success($msg);
print_error($error);
?>
<div class="row">
<div>
<form role="form" class="form-horizontal" method="post" action="admin.php?act=addauthkey">
<div class="form-group">
<label for="company_name" class="col-sm-2 control-label">Company Name : </label>
<div class="col-sm-4">
<input type="text" name ="company_name" class="form-control" id="inp_company_name" placeholder="Company Name" value="<?php
echo $api_company_name;
?>
">
</div>
<div class="col-sm-6"></div>
示例12: createHost
function createHost($hostname, $snmp_community = NULL, $snmp_version, $snmp_port = 161, $snmp_transport = 'udp', $snmp_v3 = array())
{
$hostname = trim(strtolower($hostname));
$device = array('hostname' => $hostname, 'sysName' => $hostname, 'status' => '1', 'snmp_community' => $snmp_community, 'snmp_port' => $snmp_port, 'snmp_transport' => $snmp_transport, 'snmp_version' => $snmp_version);
// Add snmp v3 auth params
foreach (array('authlevel', 'authname', 'authpass', 'authalgo', 'cryptopass', 'cryptoalgo') as $v3_key) {
if (isset($snmp_v3['snmp_' . $v3_key])) {
// Or $snmp_v3['snmp_authlevel']
$device['snmp_' . $v3_key] = $snmp_v3['snmp_' . $v3_key];
} else {
if (isset($snmp_v3[$v3_key])) {
// Or $snmp_v3['authlevel']
$device['snmp_' . $v3_key] = $snmp_v3[$v3_key];
}
}
}
// This is compatibility code after refactor in r6306, for keep devices up before DB updated
if (get_db_version() < 189) {
// FIXME. Remove this in r7000
$device['snmpver'] = $device['snmp_version'];
unset($device['snmp_version']);
foreach (array('transport', 'port', 'timeout', 'retries', 'community', 'authlevel', 'authname', 'authpass', 'authalgo', 'cryptopass', 'cryptoalgo') as $old_key) {
if (isset($device['snmp_' . $old_key])) {
// Convert to old device snmp keys
$device[$old_key] = $device['snmp_' . $old_key];
unset($device['snmp_' . $old_key]);
}
}
}
$device['os'] = get_device_os($device);
$device['snmpEngineID'] = snmp_cache_snmpEngineID($device);
$device['sysName'] = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
$device['location'] = snmp_get($device, "sysLocation.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
$device['sysContact'] = snmp_get($device, "sysContact.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
if ($device['os']) {
$device_id = dbInsert($device, 'devices');
if ($device_id) {
log_event("設備添加: {$hostname}", $device_id, 'device', $device_id, 5);
// severity 5, for logging user/console info
if (is_cli()) {
print_success("正在使用自動發現功能 " . $device['hostname'] . " (id = " . $device_id . ")");
$device['device_id'] = $device_id;
// Discover things we need when linking this to other hosts.
discover_device($device, $options = array('m' => 'ports'));
discover_device($device, $options = array('m' => 'ipv4-addresses'));
discover_device($device, $options = array('m' => 'ipv6-addresses'));
log_event("snmpEngineID -> " . $device['snmpEngineID'], $device, 'device', $device['device_id']);
// Reset `last_discovered` for full rediscover device by cron
dbUpdate(array('last_discovered' => 'NULL'), 'devices', '`device_id` = ?', array($device_id));
array_push($GLOBALS['devices'], $device_id);
}
return $device_id;
} else {
return FALSE;
}
} else {
return FALSE;
}
}
示例13: print_message
print_message("Adding host {$hostname} communit" . (count($config['snmp']['community']) == 1 ? "y" : "ies") . " " . implode(', ', $config['snmp']['community']) . " port {$port}");
} elseif ($_POST['snmpver'] === "v3") {
$v3 = array('authlevel' => $_POST['authlevel'], 'authname' => $_POST['authname'], 'authpass' => $_POST['authpass'], 'authalgo' => $_POST['authalgo'], 'cryptopass' => $_POST['cryptopass'], 'cryptoalgo' => $_POST['cryptoalgo']);
array_push($config['snmp']['v3'], $v3);
$snmpver = "v3";
print_message("Adding SNMPv3 host {$hostname} port {$port}");
} else {
print_error("Unsupported SNMP Version. There was a dropdown menu, how did you reach this error ?");
// We have a hacker!
}
if ($_POST['ignorerrd'] == 'confirm') {
$config['rrd_override'] = TRUE;
}
$result = add_device($hostname, $snmpver, $port);
if ($result) {
print_success("Device added (id = {$result})");
}
} else {
print_error("You don't have the necessary privileges to add hosts.");
}
}
$pagetitle[] = "Add host";
?>
<form name="form1" method="post" action="" class="form-horizontal">
<p>Devices will be checked for Ping and SNMP reachability before being probed. Only devices with recognised OSes will be added.</p>
<fieldset>
<legend>Device Properties</legend>
<div class="control-group">
示例14: print_error_permission
*
* This file is part of Observium.
*
* @package observium
* @subpackage webui
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if ($_SESSION['userlevel'] < 10) {
print_error_permission();
return;
}
echo '<div style="margin: 10px;">';
if (auth_usermanagement()) {
if ($vars['action'] == "deleteuser") {
$delete_username = dbFetchCell("SELECT `username` FROM `users` WHERE `user_id` = ?", array($vars['user_id']));
if ($vars['confirm'] == "yes") {
if (deluser($delete_username)) {
print_success('User "' . escape_html($delete_username) . '" deleted!');
} else {
print_error('Error deleting user "' . escape_html($delete_username) . '"!');
}
} else {
print_error('You have requested deletion of the user "' . escape_html($delete_username) . '". This action can not be reversed.<br /><a href="edituser/action=deleteuser/user_id=' . $vars['user_id'] . '/confirm=yes/">Click to confirm</a>');
}
}
} else {
print_error("Authentication module does not allow user management!");
}
echo '</div>';
// EOF
示例15: exec_ogp_module
//.........這裏部分代碼省略.........
$remote = new OGPRemoteLibrary($home_info['agent_ip'], $home_info['agent_port'], $home_info['encryption_key']);
$server_xml = read_server_config(SERVER_CONFIG_LOCATION . "/" . $home_info['home_cfg_file']);
if (!$server_xml) {
echo "<table class='center'><tr><td><a href='?m=gamemanager&p=game_monitor&home_id-mod_id-ip-port=" . $home_info['home_id'] . "-" . $home_info['mod_id'] . "-" . $_REQUEST['ip'] . "-" . $_REQUEST['port'] . "'><< " . get_lang('back') . "</a></td></tr></table>";
return;
}
// It compares ip and port on POST with the pair on DB for security reasons (URL HACKING)
$home_id = $home_info['home_id'];
$ip_info = $db->getHomeIpPorts($home_id);
foreach ($ip_info as $ip_ports_row) {
if ($ip_ports_row['ip'] == $_REQUEST['ip'] && $ip_ports_row['port'] == $_REQUEST['port']) {
$ip = $ip_ports_row['ip'];
$port = $ip_ports_row['port'];
}
}
if (!isset($ip) or !isset($port)) {
echo "<h2>" . get_lang_f('ip_port_pair_not_owned') . "</h2>";
echo "<table class='center'><tr><td><a href='?m=gamemanager&p=game_monitor&home_id-mod_id-ip-port={$home_id}-{$mod_id}-{$ip}-{$port}'><< " . get_lang('back') . "</a></td></tr></table>";
return;
}
if (isset($server_xml->console_log)) {
$log_retval = $remote->remote_readfile($home_info['home_path'] . '/' . $server_xml->console_log, $home_log);
} else {
$log_retval = $remote->get_log(OGP_SCREEN_TYPE_HOME, $home_info['home_id'], clean_path($home_info['home_path'] . "/" . $server_xml->exe_location), $home_log);
}
function getLastLines($string, $n = 1)
{
$lines = explode("\n", $string);
$lines = array_slice($lines, -$n);
return implode("\n", $lines);
}
$home_log = getLastLines($home_log, 40);
if ($log_retval > 0) {
if ($log_retval == 2) {
print_failure(get_lang('server_not_running_log_found'));
}
echo "<pre style='background:black;color:white;'>" . $home_log . "</pre>";
if ($log_retval == 2) {
return;
}
} else {
print_failure(get_lang_f('unable_to_get_log', $log_retval));
}
// If game is not supported by lgsl we skip the lgsl checks and
// assume successfull start.
if ($home_info['use_nat'] == 1) {
$query_ip = $home_info['agent_ip'];
} else {
$query_ip = $ip;
}
$running = $remote->is_screen_running(OGP_SCREEN_TYPE_HOME, $home_info['home_id']);
if ($server_xml->lgsl_query_name) {
require 'protocol/lgsl/lgsl_protocol.php';
$get_q_and_s = lgsl_port_conversion((string) $server_xml->lgsl_query_name, $port, "", "");
//Connection port
$c_port = $get_q_and_s['0'];
//query port
$q_port = $get_q_and_s['1'];
//software port
$s_port = $get_q_and_s['2'];
$data = lgsl_query_live((string) $server_xml->lgsl_query_name, $query_ip, $c_port, $q_port, $s_port, "sa");
if ($data['b']['status'] == "0") {
$running = FALSE;
}
} elseif ($server_xml->gameq_query_name) {
require 'protocol/GameQ/GameQ.php';
$query_port = get_query_port($server_xml, $port);
$servers = array(array('id' => 'server', 'type' => (string) $server_xml->gameq_query_name, 'host' => $query_ip . ":" . $query_port));
$gq = new GameQ();
$gq->addServers($servers);
$gq->setOption('timeout', 4);
$gq->setOption('debug', FALSE);
$gq->setFilter('normalise');
$game = $gq->requestData();
if (!$game['server']['gq_online']) {
$running = FALSE;
}
}
if (!$running) {
if (!isset($_GET['retry'])) {
$retry = 0;
} else {
$retry = $_GET['retry'];
}
if ($retry >= 5) {
echo "<p>" . get_lang('server_running_not_responding') . "\n\t\t\t<a href=?m=gamemanager&p=stop&home_id=" . $home_info['home_id'] . "&ip=" . $ip . "&port=" . $port . ">" . get_lang('already_running_stop_server') . ".</a></p>";
echo "<table class='center'><tr><td><a href='?m=gamemanager&p=game_monitor&home_id-mod_id-ip-port={$home_id}-{$mod_id}-{$ip}-{$port}'><< " . get_lang('back') . "</a></td></tr></table>";
}
echo "</b>Retry #" . $retry . ".</b>";
$retry++;
print "<p class='note'>" . get_lang('starting_server') . "</p>";
$view->refresh("?m=gamemanager&p=start&refresh&ip={$ip}&port={$port}&home_id={$home_id}&mod_id={$mod_id}&retry=" . $retry, 3);
return;
}
print_success(get_lang('server_started'));
$ip_id = $db->getIpIdByIp($ip);
$db->delServerStatusCache($ip_id, $port);
$view->refresh("?m=gamemanager&p=game_monitor&home_id-mod_id-ip-port={$home_id}-{$mod_id}-{$ip}-{$port}");
return;
}