unexpected errors from nowhere

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

unexpected errors from nowhere

Post by gaogier »

Warning: main() [function.main]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/gaogier/public_html/footer.inc on line 174

Warning: main(http://runehinst.com/fstats.php) [function.main]: failed to open stream: Permission denied in /home/gaogier/public_html/footer.inc on line 174

Warning: main() [function.include]: Failed opening 'http://runehinst.com/fstats.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gaogier/public_html/footer.inc on line 174


code for fstats.php

Code: Select all

<head> 
<link rel="shortcut icon" href="images/icon/favicon.ico" type="image/x-icon" />
<!--<link rel="stylesheet" type="text/css" href="darkblue.css">-->
<link rel="stylesheet" type="text/css" media="screen" title="User Defined Style" href="<?php echo (!$sitestyle)?'darkblue':$sitestyle ?>.css" />
<?php
if (!$sitestyle){
$sitestyle = "darkblue";
}
?>
</head>
<body bgcolor="#000000">
<?php
require_once ('../mysql_connect1.php');//connect to db
define('IN_PHPBB', true);
define('PHPBB_INSTALLED', true);
$phpbb_root_path = 'forums/';
include('forums/extension.inc');
include('forums/common.php');

$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];

$sql = "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, u.user_whosonline_color, s.session_logged_in, s.session_time, s.session_page, s.session_ip
	FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
	WHERE u.user_id = s.session_user_id
		AND s.session_time >= ".( time() - 300 ) . "
	ORDER BY u.username ASC, s.session_ip ASC";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not obtain regd user/online information', '', __LINE__, __FILE__, $sql);
}

$guest_users = 0;
$registered_users = 0;
$hidden_users = 0;

$reg_counter = 0;
$guest_counter = 0;
$prev_user = 0;
$prev_ip = '';

while ( $row = $db->sql_fetchrow($result) )
{
	$view_online = false;

	if ( $row['session_logged_in'] ) 
	{
		$user_id = $row['user_id'];

		if ( $user_id != $prev_user )
		{
			$username = $row['username'];

			$style_color = '';
			if ( $row['user_whosonline_color'] )
			{
				$username = '<b style="color:' . $id_color[$row[user_whosonline_color]] . '">' . $username . '</b>';
			}
			else if ( $row['user_level'] == ADMIN )
			{
				$username = '<b style="color:#' . $theme['fontcolor3'] . '">' . $username . '</b>';
			}
			else if ( $row['user_level'] == MOD )
			{
				$username = '<b style="color:#' . $theme['fontcolor2'] . '">' . $username . '</b>';
			}
						else if ( $user_group_color[$row['user_id']])
			{
				$username = '<b style="color:' . $user_group_color[ $row['user_id'] ] . '">' . $username . '</b>';
			}

			if ( !$row['user_allow_viewonline'] )
			{
				$view_online = ( $userdata['user_level'] == ADMIN ) ? true : false;
				$hidden_users++;

				$username = '<i>' . $username . '</i>';
			}
			else
			{
				$view_online = true;
				$registered_users++;
			}

			$which_counter = 'reg_counter';
			$which_row = 'reg_user_row';
			$prev_user = $user_id;
		}
	}
	else
	{
		if ( $row['session_ip'] != $prev_ip )
		{
			$username = $lang['Guest'];
			$view_online = true;
			$guest_users++;
	
			$which_counter = 'guest_counter';
			$which_row = 'guest_user_row';
		}
	}

	$prev_ip = $row['session_ip'];
}
echo '<font class="small">';
echo 'Registered Users:</font> <font class="small2">'.$total_users;
echo '</font><font class="small">';
echo '<br />Newest User:</font> <a href="forums/profile.php?mode=viewprofile&u='.$newest_uid.'">'.$newest_user.'</a>';
echo '<font class="small">';
echo '<br />Total Posts:</font> <font class="small2">'.$total_posts.'</font>';
echo '<font class="small">';
echo '<br />Users online:</font> <font class="small2">'.$registered_users.'</font>';
echo '<font class="small">';
echo '<br />Guests online:</font> <font class="small2">'.$guest_users.'</font>';

				?>
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

The error message is "Failed opening 'http://runehinst.com/fstats.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gaogier/public_html/footer.inc on line 174" which means that it tried to include fstats.php on line 174 of footer.inc but could not find the file in either the current directory '.' or '/usr/lib/php:/usr/local/lib/php' (see include_path) so the file must be somewhere else, perhaps in a sub-directory.
(#10850)
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

the thing is, its not moved
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

It doesn't matter if it is "moved" whatever that means It only matters if it is in one of the directories that PHP is looking in. The problem is the include in footer.inc. It probably should be '../fstats.php' or 'forums/fstats.php' or some other path so PHP can find the file.
(#10850)
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

ok, i have cut it down to

Code: Select all

<?php
include_once ('fstats.php'); 
?>
it works...but the design goes

take a look, http://runehints.com/footer.php (with the fill http://runehints.com/fstats.php)

take a look, http://runehints.com/footer2.php (only fstats.php)
Post Reply