本文整理汇总了PHP中print_failure函数的典型用法代码示例。如果您正苦于以下问题:PHP print_failure函数的具体用法?PHP print_failure怎么用?PHP print_failure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_failure函数的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 $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;
}
// Delete user from group.
if (isset($_GET['group_id']) && isset($_GET['user_id'])) {
$group_id = trim($_GET['group_id']);
$user_id = trim($_GET['user_id']);
if (!$db->delUserFromGroup($user_id, $group_id)) {
print_failure(get_lang_f('could_not_delete_user_from_group', $user_id, $group_id));
$view->refresh("?m=user_admin");
return;
}
echo "<p class='success'>" . get_lang_f('successfully_removed_from_group', $user_id, $group_id) . "</p>";
$db->logger(get_lang_f('successfully_removed_from_group', $user_id, $group_id));
$view->refresh("?m=user_admin&p=show_groups");
}
}
示例3: exec_ogp_module
function exec_ogp_module()
{
global $db;
global $view;
$group_id = $_REQUEST['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;
}
if (isset($_POST['add_user_to_group'])) {
$group_id = trim($_POST['group_id']);
$user_id = trim($_POST['user_to_add']);
$username = $db->getUserById($user_id);
$group_name = $db->getGroupById($group_id);
if (!$db->addUsertoGroup($user_id, $group_id)) {
print_failure(get_lang_f('could_not_add_user_to_group', $username['users_login'], $group_name['group_name']));
$view->refresh("?m=user_admin&p=show_groups");
return;
}
echo "<p class='success'>" . get_lang_f('successfully_added_to_group', $username['users_login'], $group_name['group_name']) . "</p>";
$db->logger(get_lang_f('successfully_added_to_group', $username['users_login'], $group_name['group_name']));
$view->refresh("?m=user_admin&p=show_groups");
}
}
示例4: 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;
}
}
示例5: 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");
}
示例6: heading
function heading()
{
global $db, $view, $settings;
if (!file_exists(CONFIG_FILE)) {
print_failure(get_lang('failed_to_read_config'));
$view->refresh("index.php");
return;
}
// Start Output Buffering
if (!isset($_SESSION['users_login'])) {
print_failure(get_lang('invalid_login_information'));
echo "<p class='note' style='color:red;'>" . get_lang('invalid_redirect') . "...</p>";
echo "<meta http-equiv='refresh' content='2;url=index.php'";
return;
} else {
$info = $db->getUser($_SESSION['users_login']);
$chk_expire = $info['user_expires'];
$exptime = read_expire($chk_expire);
if ($exptime != "X") {
list($days, $strd, $hours, $strh, $minutes, $strm) = explode(" ", $exptime);
$minutes2expire = $minutes + intval($hours * 60) + intval($days * 24 * 60);
if ($minutes2expire <= 0) {
echo "<h1>" . get_lang('account_expired') . "</h1>";
echo "<p class='note'>" . get_lang('contact_admin_to_enable_account') . "</p>";
session_destroy();
return;
}
}
if (isset($settings['maintenance_mode']) && $settings['maintenance_mode'] == "1") {
if ($_SESSION['users_group'] == "user") {
echo "<h2>" . $settings['maintenance_title'] . "</h2>";
echo "<p>" . $settings['maintenance_message'] . "</p>";
$view->setTitle("OGP: Maintenance.");
echo "<p class='failure'>" . get_lang('logging_out_10') . "...</p>";
echo "<meta http-equiv='refresh' content='10;url=index.php'";
session_destroy();
return;
}
}
if (isset($_REQUEST['logout'])) {
session_destroy();
print_success(get_lang('logout_message'));
$view->refresh("index.php");
return;
}
include "includes/navig.php";
}
if (isset($maintenance)) {
echo $maintenance;
}
}
示例7: read_server_config
function read_server_config($filename)
{
$dom = new DOMDocument();
if ($dom->load($filename) === FALSE) {
print_failure(get_lang_f('unable_to_load_xml', $filename));
return FALSE;
}
if ($dom->schemaValidate(XML_SCHEMA) != TRUE) {
print_failure(get_lang_f('xml_file_not_valid', $filename, XML_SCHEMA));
return FALSE;
}
$xml = simplexml_load_file($filename);
$xml->addChild('home_cfg_file', basename($filename));
return $xml;
}
示例8: exec_ogp_module
function exec_ogp_module()
{
require_once MODULES . "/litefm/litefm.php";
$home_id = $_REQUEST['home_id'];
if (empty($home_id)) {
print_failure(get_lang('home_id_missing'));
return;
}
if (litefm_check($home_id) === FALSE) {
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;
}
echo "<table class='center' style='width:100%;'>" . show_back($home_id) . "</table>";
//Logic to open the file we're editing
$remote = new OGPRemoteLibrary($home_cfg['agent_ip'], $home_cfg['agent_port'], $home_cfg['encryption_key']);
$data = "";
$file_info = $remote->remote_readfile($home_cfg['home_path'] . "/" . $_SESSION['fm_cwd_' . $home_id], $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=litefm&p=write_file' method='post'>";
echo "<input type='hidden' name='home_id' value='{$home_id}' />";
echo "<textarea name='file_content' style='width:98%;' rows='40'>{$data}</textarea>";
echo "<p><input type='submit' name='save_file' value='" . get_lang('save') . "' /></p>";
echo "</form>";
show_back($home_id);
}
示例9: exec_ogp_module
function exec_ogp_module()
{
global $db, $view, $settings;
if (is_readable("includes/config.inc.php")) {
require "includes/config.inc.php";
}
$isAdmin = $db->isAdmin($_SESSION['user_id']);
if ($isAdmin) {
$user_homes = $db->getIpPorts();
} else {
$user_homes = $db->getIpPortsForUser($_SESSION['user_id']);
}
echo "<h2>" . get_lang('ftp') . "</h2>";
if ($user_homes === FALSE) {
// If there are no games, then there can not be any mods either.
print_failure('No game homes assigned');
if ($isAdmin) {
echo "<p><a href='?m=user_games&p=assign&user_id={$_SESSION['user_id']}'>Assign game homes</a></p>";
}
return;
}
if (empty($_GET['home_id'])) {
unset($_GET['home_id']);
}
if (!isset($_GET['home_id'])) {
create_home_selector($_GET['m'], FALSE, $user_homes);
$show_all = TRUE;
} else {
create_home_selector($_GET['m'], FALSE, $user_homes);
create_home_selector($_GET['m'], FALSE, "show_all");
$show_all = FALSE;
}
if (isset($_GET['home_id'])) {
$_SESSION['home_id'] = $_GET['home_id'];
}
$_SESSION['time_zone'] = $settings['time_zone'];
?>
<IFRAME SRC="modules/ftp/index.php<?php
if (isset($_GET['home_id'])) {
echo "?home_id=" . $_GET['home_id'];
}
?>
" ALIGN=center WIDTH=100% HEIGHT=460 style="border:1px solid transparent;background-color:white" >
</IFRAME>
<?php
if ($show_all == FALSE) {
echo "<form action='' method='get'>\n\t\t\t <input type='hidden' name='m' value='gamemanager' />\n\t\t\t <input type='hidden' name='p' value='game_monitor' />\n\t\t\t <input type='hidden' name='home_id' value='" . $_GET['home_id'] . "' />\n\t\t\t <input type='submit' value='" . get_lang('back') . "' />\n\t\t\t </form>";
示例10: exec_ogp_module
function exec_ogp_module()
{
echo "<h2>" . get_lang('ban_list') . "</h2>";
global $db;
if (isset($_POST['unban'])) {
unset($_POST['unban']);
foreach ($_POST as $name => $ip) {
$db->query("UPDATE `OGP_DB_PREFIXban_list` SET logging_attempts='0', banned_until='0' WHERE client_ip = '{$ip}';");
}
}
$ban_list = $db->resultQuery("SELECT logging_attempts, banned_until, client_ip FROM `OGP_DB_PREFIXban_list`;");
$ban_qty = 0;
$ban_table = '';
foreach ($ban_list as $ban) {
if ($ban['logging_attempts'] >= 3) {
$ban_table .= "<tr><td><input type=checkbox name='" . $ban_qty . "' value='" . $ban['client_ip'] . "' /></td><td>" . $ban['client_ip'] . "</td><td>" . date("r", $ban['banned_until']) . "</td></tr>\n";
$ban_qty++;
} else {
continue;
}
}
if ($ban_qty == 0) {
print_failure(get_lang('no_banned_ips'));
} else {
echo "<form method=post >\n" . "<table><tr><th><span id=check >" . get_lang('unban') . "</span></th><th>" . get_lang('client_ip') . "</th><th>" . get_lang('banned_until') . "</th></tr>\n" . $ban_table . "</table>\n" . "<input type=submit name=unban value='" . get_lang('unban_selected_ips') . "' /></form>";
?>
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$('span#check').css({'cursor':'pointer','color':'blue'});
$('span#check').click(function(){
$('input[type=checkbox]').each(function( ){
if( this.checked )
{
$(this).attr('checked', false);
}
else
{
$(this).attr('checked', true);
}
});
});
</script>
<?php
}
echo create_back_button($_GET['m'], "main");
}
示例11: litefm_check
function litefm_check($home_id)
{
if (isset($_GET['path']) and !isset($_GET['upload']) and !isset($_POST['delete']) and !isset($_POST['create_folder']) and !isset($_POST['secureButton']) and !isset($_POST['delete_check']) and !isset($_POST['secure_check'])) {
$path = $_GET['path'];
// Make sure nobody tries to get outside thier game server by referencing the .. directory
if (preg_match("/\\.\\.|\\||;/", $path)) {
print_failure(get_lang("unallowed_char"));
$_SESSION['fm_cwd_' . $home_id] = NULL;
return FALSE;
} else {
$_SESSION['fm_cwd_' . $home_id] = @$_SESSION['fm_cwd_' . $home_id] . "/" . $path;
}
}
// To go back a dir, we just use dirname to strip the last directory or file off the path
if (isset($_GET['back']) and !isset($_GET['upload']) and !isset($_POST['delete']) and !isset($_POST['create_folder']) and !isset($_POST['secureButton']) and !isset($_POST['delete_check']) and !isset($_POST['secure_check'])) {
$_SESSION['fm_cwd_' . $home_id] = str_replace("\\", "", dirname($_SESSION['fm_cwd_' . $home_id]));
}
return TRUE;
}
示例12: 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");
}
}
示例13: 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>";
}
示例14: 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");
}
示例15: 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");
}