• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP print_success函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中print_success函数的典型用法代码示例。如果您正苦于以下问题:PHP print_success函数的具体用法?PHP print_success怎么用?PHP print_success使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了print_success函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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&amp;p=del&amp;user_id={$user_id}&amp;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");
}
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:34,代码来源:del_user.php


示例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;
    }
}
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:58,代码来源:add_server.php


示例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");
}
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:13,代码来源:delete_module.php


示例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();
}
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:45,代码来源:themes.php


示例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&amp;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&amp;p=show_groups");
    }
}
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:20,代码来源:add_group.php


示例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&amp;p=log&amp;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>";
}
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:41,代码来源:view_log.php


示例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");
}
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:21,代码来源:add_module.php


示例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&amp;p=del_group&amp;group_id={$group_id}&amp;y=y\">" . get_lang('yes') . "</a> <a href=\"?m=user_admin&amp;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&amp;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&amp;p=show_groups");
}
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:38,代码来源:del_group.php


示例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>";
}
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:38,代码来源:fm_write.php


示例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 
//.........这里部分代码省略.........
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:101,代码来源:addons_manager.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>
开发者ID:dasatti,项目名称:dashboard,代码行数:31,代码来源:addauthkey.php


示例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;
    }
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:59,代码来源:functions.inc.php


示例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">
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:addhost.inc.php


示例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
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:deleteuser.inc.php


示例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&amp;p=game_monitor&amp;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&amp;p=game_monitor&amp;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&amp;p=stop&amp;home_id=" . $home_info['home_id'] . "&amp;ip=" . $ip . "&amp;port=" . $port . ">" . get_lang('already_running_stop_server') . ".</a></p>";
            echo "<table class='center'><tr><td><a href='?m=gamemanager&amp;p=game_monitor&amp;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&amp;p=start&amp;refresh&amp;ip={$ip}&amp;port={$port}&amp;home_id={$home_id}&amp;mod_id={$mod_id}&amp;retry=" . $retry, 3);
        return;
    }
    print_success(get_lang('server_started'));
    $ip_id = $db->getIpIdByIp($ip);
    $db->delServerStatusCache($ip_id, $port);
    $view->refresh("?m=gamemanager&amp;p=game_monitor&amp;home_id-mod_id-ip-port={$home_id}-{$mod_id}-{$ip}-{$port}");
    return;
}
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:101,代码来源:start_server.php


示例16: get_user_prefs

if (is_numeric($_SESSION['user_id'])) {
    $user_id = $_SESSION['user_id'];
    $prefs = get_user_prefs($user_id);
    // Reset RSS/Atom key
    if ($vars['atom_key'] == "toggle") {
        if (set_user_pref($user_id, 'atom_key', md5(strgen()))) {
            print_success('RSS/Atom key updated.');
            $prefs = get_user_prefs($user_id);
        } else {
            print_error('Error generating RSS/Atom key.');
        }
    }
    // Reset API key
    if ($vars['api_key'] == "toggle") {
        if (set_user_pref($user_id, 'api_key', md5(strgen()))) {
            print_success('API key updated.');
            $prefs = get_user_prefs($user_id);
        } else {
            print_error('Error generating API key.');
        }
    }
}
$atom_key_updated = isset($prefs['atom_key']['updated']) ? formatUptime(time() - strtotime($prefs['atom_key']['updated']), 'shorter') . ' ago' : 'Never';
$api_key_updated = isset($prefs['api_key']['updated']) ? formatUptime(time() - strtotime($prefs['api_key']['updated']), 'shorter') . ' ago' : 'Never';
$filename = $config['html_dir'] . '/pages/preferences/' . $vars['section'] . '.inc.php';
if (is_file($filename)) {
    $vars = get_vars('POST');
    // Note, on edit pages use only method POST!
    include $filename;
} else {
    print_error('<h4>Page does not exist</h4>
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:preferences.inc.php


示例17: chdir

 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage cli
 * @author     Adam Armstrong <[email protected]>
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
chdir(dirname($argv[0]));
include "includes/defaults.inc.php";
include "config.php";
include "includes/definitions.inc.php";
include "includes/functions.inc.php";
$scriptname = basename($argv[0]);
print_message("%g" . OBSERVIUM_PRODUCT . " " . OBSERVIUM_VERSION . "\n%WRemove Device%n\n", 'color');
// Remove a host and all related data from the system
if ($argv[1]) {
    $host = strtolower($argv[1]);
    $id = getidbyname($host);
    $delete_rrd = isset($argv[2]) && strtolower($argv[2]) == 'rrd' ? TRUE : FALSE;
    // Test if a valid id was fetched from getidbyname.
    if (isset($id) && is_numeric($id)) {
        print_warning(delete_device($id, $delete_rrd));
        print_success("Device {$host} removed.");
    } else {
        print_error("Device {$host} doesn't exist!");
    }
} else {
    print_message("%n\nUSAGE:\n{$scriptname} <hostname> [rrd]\n\nEXAMPLE:\n%WKeep RRDs%n:   {$scriptname} <hostname>\n%WRemove RRDs%n: {$scriptname} <hostname> rrd\n\n%rInvalid arguments!%n", 'color', FALSE);
}
// EOF
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:delete_device.php


示例18: exec_ogp_module


//.........这里部分代码省略.........
        // Check if any error occured
        if ($download_available) {
            $bytes = is_array($headers['Content-Length']) ? $headers['Content-Length'][1] : $headers['Content-Length'];
            // Display the File Size
            $totalsize = $bytes / 1024;
            clearstatcache();
        }
        $kbytes = $remote->rsync_progress($home_info['home_path'] . "/" . $addon_info['path'] . "/" . $filename);
        list($totalsize, $mbytes, $pct) = explode(";", do_progress($kbytes, $totalsize));
        $totalmbytes = round($totalsize / 1024, 2);
        $pct = $pct > 100 ? 100 : $pct;
        echo "<h2>" . $home_info['home_name'] . "</h2>";
        echo '<div class="dragbox bloc rounded" style="background-color:#dce9f2;" >
				<h4>' . get_lang('install') . " " . $filename . " {$mbytes}MB/{$totalmbytes}MB</h4>\n\t\t\t  <div style='background-color:#dce9f2;' >\n\t\t\t  ";
        $bar = '';
        for ($i = 1; $i <= $pct; $i++) {
            $bar .= '<img style="width:0.92%;vertical-align:middle;" src="images/progressBar.png">';
        }
        echo "<center>{$bar} <b style='vertical-align:top;display:inline;font-size:1.2em;color:red;' >{$pct}%</b></center>\n\t\t\t\t</div>\n\t\t\t  </div>";
        if (($pct == "100" or !$download_available) and $post_script != "") {
            $log_retval = $remote->get_log("post_script", $pid, clean_path($home_info['home_path'] . "/" . $server_xml->exe_location), $script_log);
            if ($log_retval == 0) {
                print_failure(get_lang('agent_offline'));
            } elseif ($log_retval == 1 || $log_retval == 2) {
                echo "<pre class='log'>" . $script_log . "</pre>";
            } elseif ($remote->is_screen_running("post_script", $pid) == 1) {
                print_failure(get_lang_f('unable_to_get_log', $log_retval));
            }
        }
        if ($pct == "100" or !$download_available or $download_available and $pct == "-" and $pid > 0) {
            if (!$download_available) {
  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP print_successful_redirect函数代码示例发布时间:2022-05-15
下一篇:
PHP print_submit_row函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap