Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
Argus
Client



Joined: Oct 06, 2003
Posts: 81

PostPosted: Sun May 30, 2004 1:58 pm Reply with quote

Hey there,

I'm using your example to work on a custom block of my own. Here's what the page I am getting the information from looks like now:

Image

I've gotten this far with the code:

Code:
<?php


if (eregi("block-ventrilo.php",$_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}

$address = "http://rentals.nuclearfallout.net/query/vstat.pl?&id=generalmayhem";

$begin = "<span class=\"clients-avail\">";
$end = "</span>";

ob_start();
$fetch = readfile($address);
$fetch = ob_get_contents();
ob_end_clean();

$clients = explode($begin, $fetch);
$clients = explode($end, $clients[1]);

$content .= "<center><b>General Mayhem Ventrilo</b></center><br>";
$content .= "<font size=\"1\">Loc: ventrilo.nuclearfallout.net:7320<br>";
$content .= "Connected Players: ";
$content .= $clients[0];
$content .= "/16<br><br>";
$content .= "<b>Channels:</b><br>"



***EDITTED***
The channels are static so I will just manually add them. The clients connected tho are not. My problem is that I have to grab all the clients in a given channel. Here's what it looks like with two channels. One with no clients and one with two clients in it.

Code:


<ul class="channel-list">
<li class="channel-line">

<span class="channel-subline-locked">
<span class="channel-start">Channel:</span>
<span class="channel-name">CyberAssault</span>
<span class="channel-id">(ID: 2)</span>
</span>
</li>


</ul>
<ul class="channel-list">
<li class="channel-line">
<span class="channel-subline-locked">
<span class="channel-start">Channel:</span>

<span class="channel-name">General Mayhem</span>
<span class="channel-id">(ID: 3)</span>
</span>
</li>

<li class="client-line">
<span class="client-subline">
<span class="client-name">I am talking to you</span>
<span class="client-ping">(Ping: 50)</span>
<span class="client-time">(5m)</span>
<span class="client-id">(ID: 42)</span>

<span class="client-admin">(normal)</span>
</span>
</li>
<li class="client-line">
<span class="client-subline">
<span class="client-name">Jon</span>
<span class="client-ping">(Ping: 54)</span>
<span class="client-time">(46m)</span>
<span class="client-id">(ID: 40)</span>
<span class="client-admin">(normal)</span>
</span>

</li>

</ul>


The full page source is available at: Only registered users can see links on this board! Get registered or login!

My problem as you may have guessed is how to grab multiple users if there are any in THAT channel. I'm stumbling on here but would appreciate any tips anyone has.

Thanks,

-Arg
 
View user's profile Send private message
Argus







PostPosted: Mon May 31, 2004 2:12 pm Reply with quote

Heya,

Ok I worked a bit further on this, but I get really sketchy where it comes to looping. Here's what I was trying to do, but it hasn't worked yet. It may be a syntax thing, I'm not sure.

Code:


$begin = "<span class=\"channel-id\">(ID: 2)</span>
</span>
</li>";
$end = "</ul>";

ob_start();
$fetch = readfile($address);
$fetch = ob_get_contents();
ob_end_clean();

<!-- If $fetch is blank, that means there were no clients in the channel as there would be no data between $begin and $end.  IF there are then we need to look for the client data.  The first one looks easy enough, but then I'm unsure if you can increment the same data tags to look down the page for a 2nd identical tag, and if so how to do it. -->

if($fetch != ""){
      $begin = "<span class=\"client-name\">";
      $end = "</span>";

      ob_start();
      $fetch = readfile($address);
      $fetch = ob_get_contents();
      ob_end_clean();

      $clients = explode($begin, $fetch);
      $clients = explode($end, $clients[1]);

      $content .= "    - ";
      $content .= $clients[0];
      $content .= "<br>";


      }

$content .= "<br>";

$content .= "    <font color=\"red\">General Mayhem<br></font>";


Any suggestions will be gratefully received.

-Arg
 
Argus







PostPosted: Mon May 31, 2004 2:30 pm Reply with quote

Ok so what the preceding does is this: If there is one client in one channel, the code above displays that client as being in all channels.

EDIT: The if statement is buggered for one.
 
Argus







PostPosted: Wed Jun 02, 2004 3:46 pm Reply with quote

Does anyone know if this is doable? if so, is it a major pita? Does anyone know where a tutorial for this kind of problem might exist?

Thanks much,

-Arg
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©