Clan Adverts

Sponsors

CT on Facebook

Latest Product

User Box

Anonymous
38.107.179.217
Nickname:

Password:

Security Code
Security Code
Type Security Code


PND Downloads Feed

Phpnuke Downloads
How to Delete or Reset yo...
How to Delete or Reset your PHPNuke Admin Account
Lost your admin password ?  Cant login to your admin account ?This sh...
Back Online & Stuff
Back Online & Stuff
Look at us with our nifty website back up and running… Seriousl...
How to edit the admins in...
How to edit the admins in the forums
Here is a way to make someone admin in your forums on your Evo site. I...
Demo Splash Screen
Demo Splash Screen
Ped @ Clan Themes has released a simple splash screen entrance hack. ...
Free Phpnuke Business The...
Free Phpnuke Business Theme 6
This is the 6th Business theme for Phpnuke that Clan Themes has releas...
Tricked Out Slider
Tricked Out Slider
We have seen some great new things come out of Tricked Out News and th...

Custom Work

PHP Nuke Custom Work

www.clanthemes.com :: View topic - Need help with a raven shield query block
Need help with a raven shield query block

2 Replies / 2898 Views


Post new topic   Reply to topic  

   www.clanthemes.com Forum Index » Blocks

View previous topic :: View next topic


TimBitz
Reputation: 29.8 Add RepSubtract Rep
Local time: 3:04 AM

canada.gif

Spawn Killer
Spawn Killer

0.03 posts per day
Medals: 0

Joined: Mar 02, 2008
Last Visit: 03 May 2011
Posts: 38
Points: 2543 

Post Need help with a raven shield query block Posted: Wed Oct 21, 2009 8:28 pm

Hey all,

I got another minor problem with a portion of my website content. Below I will include the complete original script that I used for this block. The problem I am having is the map image display.

So the way it's set up is as follows:

Determine what the map file name is and look in a certain directory for the matching file name in lower case characters and display that image in the allotted location. If the image is not found it displays nothing, well it displays the traditional broken image link box.


I have no concept of how to code this, but the way I want it to be literally is:

IF the picture for this map exists THEN display the matching image
ELSE display the image no-pic.jpg

Here is the code for the entire block:
Code:
<?php
/* #####################################################################################
 *
 *
 * project:          RvS Block
 * description:      Display Server Details
 *
 * Copyright (C) 2009 FcUK_A
 * A@fcuk.org.uk
 *
 * Copyright Notes:
 * ----------------
 * - All Rights reserved
 * - All rights reserved to their proper authors.
 * - using the script(s) without the owners permission is prohibited
 *
 * NOTE:
 * This script can be used to include todays calendarevents in a menu on your site
 *
 * YOU CAN CHANGE HTML OUTPUT BELOW THIS LINE AS NEEDED !!!
 * #####################################################################################
 */
if (eregi("block-rvs-server.php",$PHP_SELF)) {
   Header("Location: index.php");
   die();
}
 
$port="port";
$host="udp://xxx.xIx.xPx.xxx";
$message="REPORT";
$status=senddatab3($host,$port,$message);

//print "$status";
// Use List and split command to parse the data
list($ServerBeaconPort,
      $BeaconPort,
      $Cmap,
      $name,//server name
      $Ctype,
      $MaxP,
      $Locked,//works 0 or 1
      $Ded,
      $Plist,
      $Ptime,
      $Pping,
      $Pkills,
      $Numplay,
      $Rounds,
      $Rtime,
      $Btime,
      $bomb,
      $sname,
      $Iserver,//????
      $Ffire,
      $Balteam,
      $TK,
      $Ver,//server version
      $Radar,//radar on/off
      $Lid,
      $Gid,
      $Bport,
      $Numter,
      $AIback,
      $Rmap,
      $PlayerKills,
      $Killedby,
      $FPW,//1st person wep on/off
      $mname,//game name ? ie rvs or asword
      $pb,//pb on/off
      $Maps,//mapl on rotation
      $GType)= split ("¶", $status
, 36);
if ($Ctype == 'F1 3 ' ||  $Ctype == 'F1 5 ' || $Ctype == 'F1 7 ') // check if co-op
     { list($ServerBeaconPort,             //
      $BeaconPort,
      $Cmap,
      $name,
      $Ctype,
      $MaxP,
      $Locked,
      $Ded,
      $Plist,
      $Ptime,
      $Pping,
      $Pkills,
      $Numplay,
      $Rounds,
      $Rtime,
      $Btime,
      $bomb,
      $sname,
      $Iserver,
      $Ffire,
      $Balteam,
      $TK,
      $Ver,
      $Radar,
      $Lid,
      $Gid,
      $Bport,
      $Numter,
      $AIback,
      $Rmap,
      $FPW,
      $mname,
      $pb, 
      $Killedby,
      $PlayerKills,
      $Maps,
      $GType)= split ("¶", $status
, 36);
//Print "co-op";
}
$patterns = array ("/14/", "/13/", "/8/","/15/","/16/","/3/","/5/","/7/");
$replace = array ("Team Survival", "Survival", "Hostage", "Bomb", "Pilot","Mission","Terrorist Hunt","Hostage Rescue");
list($A,$name) = split (" ", $name, 2);
list($A,$Cmap) = split (" ", $Cmap, 2);
list($A,$MaxP) = split (" ", $MaxP, 2);
list($A,$Numplay) = split (" ", $Numplay, 2);
list($A,$Plist) = split (" ", $Plist, 2);
list($A,$Maps) = split (" ", $Maps, 2);
list($A,$GType) = split (" ", $GType, 2);
list($A,$Ver) = split (" ", $Ver, 2);
list($A,$Ptime) = split (" ", $Ptime, 2);
list($A,$Pping) = split (" ", $Pping, 2);
list($A,$Pkills) = split (" ", $Pkills, 2);
list($A,$Ctype) = split (" ", $Ctype, 2);
list($A,$PlayerKills) = split (" ", $PlayerKills, 2);

$gctype = preg_replace ($patterns, $replace, $Ctype);


$content .= "<B><img src=\"images/rvs-maps/" . strtolower(trim($Cmap)) . ".jpg\" hight=164 width=126 ></B>";
$content .= "<BR><b>$Cmap</b><BR>";

$content .= "<BR><b>Current Players </b><b>$Numplay/$MaxP</b><BR>";
$content .= "<div class=\"container\"><BR><div class=\"left\"><b>Players</b></div><div class=\"right\"><b>Kills</b></div></div><BR>";



$parray = split("/", $Plist);
$tarray = split("/", $Ptime);
$Parray = split("/", $Pping);
$karray = split("/", $Pkills);
$count = count($parray);
for ($i=0; $i<=$count; $i++)
{
$content .= "<div class=\"container\"><div class=\"left\">$parray[$i]</div><div class=\"right\">$karray[$i]</div></div>";
//print "   $parray[$i] $tarray[$i] $Parray[$i] $karray[$i]  <BR>"; // add appropiate HTML tags here
}
$content .= "<BR><a href=\"modules.php?name=ServerQuery\"><B>Detailed Server Info</B></a><BR>";

 function senddatab3($host,$port,$message) {

#takes in account servers that do not return EOF character
#send data to server and get back input

#function globals
$linenumber="0"; #amount of lines to get rid of before we give input
$lineamount="1"; #amount of lines to read after we give input

$fp = fsockopen("$host", $port, $errno, $errstr, 30);
if (!$fp) {
  echo "$errstr ($errno)";
}
else {
  for ($i = 1; $i < $linenumber+1; $i++) {
     fread ($fp,1);
     $bytes_left = socket_get_status($fp);
     if ($bytes_left > 0) { fread($fp, $bytes_left[unread_bytes]); }
  }
  fputs($fp, "$message");
  for ($i = 1; $i < $lineamount+1; $i++) {
     $status.=fread($fp,1);
     $bytes_left = socket_get_status($fp);
     if ($bytes_left > 0) { $status.=fread($fp, $bytes_left[unread_bytes]); }
  }
  fclose ($fp);
}

return $status;
}



?>


And here is the section in that coding that refers specifically to the area in question:
Code:
$content .= "<B><img src=\"images/rvs-maps/" . strtolower(trim($Cmap)) . ".jpg\" hight=164 width=126 ></B>";
$content .= "<BR><b>$Cmap</b><BR>";


Thanks in advance for any ideas you guys can offer.
 

 
View user's profileSend private messageVisit poster's website Reply with quote

floppy
Reputation: 2087.2 Add RepSubtract Rep
votes: 22
Local time: 4:04 AM
Location: Jackson Mississippi
usa.gif

Site Admin
Site Admin

1.73 posts per day
Medals: 2 (View more...)
Dedication (Amount: 1)
Scripts/Coder
Scripts/Coder
Joined: Nov 14, 2006
Last Visit: 27 Jan 2012
Posts: 3313
Points: 132023 

Post Re: Need help with a raven shield query block Posted: Wed Oct 21, 2009 10:46 pm

Shop Purchases:
Clan Roster 2.0 · Multi Gaming (Warrior) Evo Theme · COD6 ModernWarfare 2 Teaser Splash Screen · Left for Dead Evo Extreme Version

http://php.net/manual/en/function.file-exists.php

Code:
if(file_exists(direct_path_to file)){
$content .= "blah blah";
}else{
$content .= "blah blah blah";
}


The only tricky part about the above is making sure you enter the full path to the image and not just the image name.
 

Phpnuke Downloads | VMaxxRx Male Enhancement  
View user's profileSend private messageVisit poster's website Reply with quote

TimBitz
Reputation: 29.8 Add RepSubtract Rep
Local time: 3:04 AM

canada.gif

Spawn Killer
Spawn Killer

0.03 posts per day
Medals: 0

Joined: Mar 02, 2008
Last Visit: 03 May 2011
Posts: 38
Points: 2543 

Post Need help with a raven shield query block Posted: Thu Oct 22, 2009 2:19 am

Well from your help, some examples on that site, and looking through other PHP blocks that do game server queries I came up with something that works.

Code:
if (file_exists('./rvsslwebphp/mapimages/'.strtolower(trim($Cmap)).'.jpg'))
{
$content .= "<center><img src=\"rvsslwebphp/mapimages/" . strtolower(trim($Cmap)) . ".jpg\" height=99 width=150 >";
}
else
{
$content .= "<center><img src=\"rvsslwebphp/mapimages/nopic.jpg\" height=99 width=150 >";
}


There are several other variables I removed in this block that a person could very well display if they wanted to. After I package this back up to an end-user state I will upload it to the Downloads section on this site. Raven Shield is a pretty low-key game now but you never know somebody might come looking for something like this some day.

Thanks very much for your time and help Floppy!
 

 
View user's profileSend private messageVisit poster's website Reply with quote

Post new topic   Reply to topic  
   www.clanthemes.com Forum Index » Blocks


 
2 Replies / 2898 Views
Page 1 of 1
All times are GMT
Display posts from previous:   
 
Jump to:  
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 cannot attach files in this forum
You can download files in this forum