Need Help Displaying a stat from another site

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
Wagz
Forum Newbie
Posts: 2
Joined: Tue Nov 15, 2005 1:52 am

Need Help Displaying a stat from another site

Post by Wagz »

Well i run a forum...and one of my other admins hosts a download server, with different files, its accosiated with my forum, but what i want to do, is i have a portal on my forum, with stats and other features, its for IPB 2.0.3, the portal is called MKportal, now if you know much about this, it has its own built in download database feature, but i dont want to use that, its disabled, but on the right panel of the portal, it has

XX Files:
Inside Download Server

i want it to get the number of files, from the download server my admin hosts, the download server has a file, which executes a code to grab the number of files entered into the database...

heres that code for that script...

Code: Select all

<?php
include 'includes/dbconfig.php';
include 'includes/opendb.php';
$result = mysql_query("SELECT * FROM files");
$num_rows = mysql_num_rows($result);
echo($num_rows);
include 'includes/closedb.php';
?>
so

i know a bit about php, not the best coder, but i know a fair bit, but ive gotten close, on the portal, ive edited where it shows the stats, and ive included the link to the above script... but the problem is, it shows the number right up the top of the page, not where its ment to be(right side, near bottom), and where it is ment to display it, it has the number '1' there..heres the portal code from the file i edited...

Code: Select all

<?
$content = "";
	$link_user = $mklib_board->forum_link("profile");
	$counter = $this->config['counter'];
        $countdownload = include 'www.urltothedownloadserver.com/filecount.php';
	$stat = $mklib_board->get_site_stat();
	$count_holder = sprintf ("%07d", "$counter");
	$query = $DB->query("SELECT id FROM mkp_gallery");
	$countgal = $DB->get_num_rows($query);
	$query = $DB->query("SELECT id FROM mkp_blog");
	$countblog = $DB->get_num_rows($query);
	$query = $DB->query("SELECT id FROM mkp_topsite WHERE validate = '1'");
	$countsite = $DB->get_num_rows($query);
	$query = $DB->query("SELECT id FROM mkp_reviews");
	$countrev = $DB->get_num_rows($query);
	

for ($n = 0; $n < strlen($count_holder); $n++) ($nbhits .= "<img src=\"$this->images/led/{$count_holder[$n]}.gif\" style=\"border: solid 1px #ffffff;\" alt=\"\" />");

	$content = "
				<tr>
				  <td class=\"tdblock\">
				  <span class=\"mktxtcontr\">{$stat['total_posts']}</span> {$this->lang['posts']}:
				  </td>
				</tr>
				<tr>
				  <td class=\"tdglobal\">
				  {$stat['topics']} {$this->lang['topics']}
				  </td>
				</tr>
				<tr>
				  <td class=\"tdglobal\">
				  {$stat['replies']} {$this->lang['replies']}<br />
				  </td>
				</tr>
				<tr>
				  <td class=\"tdblock\">
				  <span class=\"mktxtcontr\">$countblog</span> {$this->lang['blog']}:
				  </td>
				</tr>
				<tr>
				  <td class=\"tdglobal\">
				  {$this->lang['user_created']}<br />
				  </td>
				</tr>
				<tr>
				  <td class=\"tdblock\">
				  <span class=\"mktxtcontr\">$countgal</span> {$this->lang['images']}:
				  </td>
				</tr>
				<tr>
				  <td class=\"tdglobal\">
				  {$this->lang['in_gallery']}<br />
				  </td>
				</tr>
				<tr>
				  <td class=\"tdblock\">
				  <span class=\"mktxtcontr\">$countdownload</span> {$this->lang['files']}:
				  </td>
				</tr>
				<tr>
				  <td class=\"tdglobal\">
				  {$this->lang['in_download']}<br />
				  </td>
				</tr>
				<tr>
				  <td class=\"tdblock\">
				  <span class=\"mktxtcontr\">$countsite</span> {$this->lang['sites']}:
				  </td>
				</tr>
				<tr>
				  <td class=\"tdglobal\">
				  {$this->lang['in_topsite']}<br />
				  </td>
				</tr>
				<tr>
				  <td class=\"tdblock\">
				  <span class=\"mktxtcontr\">$countrev</span> {$this->lang['reviews']}:
				  </td>
				</tr>
				<tr>
				  <td class=\"tdglobal\">
				  {$this->lang['in_reviews']}<br />
				  </td>
				</tr>
				<tr>
				  <td class=\"tdblock\">
				  <span class=\"mktxtcontr\">{$stat['members']}</span> {$this->lang['u_registered']}:
				  </td>
				</tr>
				<tr>
				  <td class=\"tdglobal\">
				  {$this->lang['last']}: <a class=\"uno\" href=\"$link_user={$stat['last_member']}\">{$stat['last_member_name']}</a>
				  </td>
				</tr>
				<tr>
				  <td class=\"tdblock\">
				  {$this->lang['access_counter']}:
				  </td>
				</tr>
				<tr>
				  <td class=\"tdglobal\">
				  <center>$nbhits</center>
				  </td>
				</tr>
				
     	 	";

	unset($link_user);
	unset($counter);
	unset($stat);
	unset($count_holder);
	unset($query);
	unset($countgal);
	unset($countdown);
	unset($countblog);
	unset($countsite);
	unset($countrev);


?>
So plz help me get the number into the right spot...and i'll greaty appreciate it

THanks Mark...
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Why not get the download site to write the number into a text file, and simply read it with the portal site?
Wagz
Forum Newbie
Posts: 2
Joined: Tue Nov 15, 2005 1:52 am

Post by Wagz »

dw found out how to do it, i used file_get_contents() instead of include(), thnks for the help anyway
Post Reply