Hi
I use Vwar for my clans war arrangements etc. I have just installed the latest version of it and I am aware that there are php files in the extra directory which will put up a war coundown clock as well as others such as next wars sign up info etc etc. Does anyone use this because I need to know how I create a block so that this info can be displayed.
Did you try using a phpbox block and including it?
this is one of the php files in the extra directory called nextactions.php
-<?php
/* #####################################################################################
*
* $Id: nextactions.php,v 1.49 2004/09/14 15:12:49 mabu Exp $
*
* This notice must remain untouched at all times.
*
* Modifications to the script, except the official addons or hacks,
* without the owners permission are prohibited.
* All rights reserved to their proper authors.
*
* ---------------------------------------------
* http://www.vwar.de || Copyright (C) 2001-2004
* ---------------------------------------------
*
* #####################################################################################
*/
// ####################################### CONFIGURATION ###############################
// path to your main vwar-directory (with final ' / ')
// -> from the site, where this extra is included!
// -> use absolute path if you have it included in files with different directories!
// (e.g. /home/www/htdocs/mysite.com/vwar/)
// -> if included in your _header.php/_footer.php, it is normally: './'
// -> if not, use: './../'
$vwar_xroot = "./../";
// limit display to x next actions
$numnextactions = 3;
// shows the needed and signed up participants for the match
// (1=enabled / 0=disabled)
$showparticipants = 1;
// shows the irc information of a opponent
// (1=enabled / 0=disabled)
$showirc = 1;
// include header- & footer-information (1=enabled / 0=disabled)
$include = 0;
// ######################################################################################
// ################################### display nextactions #############################
// check, if we need to get some global vars or if we need to include them
if( !defined ("VWAR_COMMON_INCLUDED") )
{
$vwar_root = $vwar_xroot;
require_once ($vwar_root . "includes/functions_common.php");
}
if ( $include == 1 )
{
include_once ($vwar_root . "_header.php");
}
//update repeating wars
updateRepeatingDatelines("vwar".$n, "warid", "dateline", 1, $waroverlap);
?>
<table border="0" cellpadding="0" cellspacing="0" align="center">
<?php
$dateline = (time() - ($waroverlap * 60)) + ($timezoneoffset * 3600);
if (!defined("VWAR_WARS_FROMNOW"))
{
define("VWAR_WARS_FROMNOW", 1);
$result = $vwardb->query_first("
SELECT COUNT(warid) AS numwars
FROM vwar".$n."
WHERE status = '0'
AND dateline > '$dateline'
" . getPublicMatchtypes(1)
);
$num_nextwars = $result['numwars'];
}
if ($num_nextwars > 0)
{
$result=$vwardb->query("
SELECT vwar".$n.".warid, vwar".$n.".gameid, vwar".$n.".gametypeid, vwar".$n.".matchtypeid, status, vwar".$n.".dateline,
oppnameshort, oppircnetwork, oppircchannel, playerperteam, vwar".$n.".oppid, matchtypename, gametypename,
gameicon,gamenameshort
FROM vwar".$n.", vwar".$n."_matchtype, vwar".$n."_gametype, vwar".$n."_opponents, vwar".$n."_games
WHERE vwar".$n.".oppid = vwar".$n."_opponents.oppid
AND vwar".$n.".gametypeid = vwar".$n."_gametype.gametypeid
AND vwar".$n."_matchtype.matchtypeid = vwar".$n.".matchtypeid
AND status = '0' AND vwar".$n.".dateline > '$dateline'
AND vwar".$n.".gameid = vwar".$n."_games.gameid
" . getPublicMatchtypes(1) . "
GROUP BY vwar".$n.".warid
ORDER BY dateline ASC
LIMIT 0, $numnextactions
");
while ($row = $vwardb->fetch_array($result))
{
dbSelect ($row);
if ($row['gameicon'] != "" && file_exists($vwar_root . "images/gameicons/".$row['gameicon']))
{
$gameicon = makeimgtag($urltovwar . "images/gameicons/".$row['gameicon'], $row['gamename']);
}
else
{
$gameicon = "";
}
?>
<tr>
<td align="center">
<?php echo $gameicon; ?>
<!-- gamenameshort start
<?php echo $row['gamenameshort']; ?>:
gamenameshort end -->
<a href="<?php echo $ownhomepage; ?>" target="_blank">
<?php echo $ownnameshort; ?></a> vs. <a href="<?php echo $urltovwar; ?>war.php?action=oppinfo&oppid=<?php echo $row['oppid']; ?>"><?php echo $row['oppnameshort']; ?></a>
</td>
</tr>
<tr>
<td>» <?php echo date($longdateformat, $row['dateline']); ?></td>
</tr>
<!-- details start
<tr>
<td>» <?php echo $row['matchtypename']; ?></td>
</tr>
<tr>
<td>» <?php echo $row['gametypename']; ?></td>
</tr>
details end -->
<?php
if ($showirc == 1 && !empty($row['oppircnetwork']) && !empty($row['oppircchannel']))
{
?>
<tr>
<td>» IRC: <a href="irc://<?php echo $row['oppircnetwork']; ?>/<?php echo $row['oppircchannel']; ?>"><?php echo $row['oppircchannel']; ?></a></td>
</tr>
<?php
}
if ($showparticipants == 1)
{
$result2 = $vwardb->query_first("
SELECT COUNT(partid) AS parts
FROM vwar".$n."_participants
WHERE available = '1'
AND warid = '" . $row['warid'] . "'
");
$parts = $result2['parts'];
?>
<tr>
<td>» Participants: <font color="<?php echo ($parts >= $row['playerperteam']) ? "green" : "red"; ?>"><?php echo $parts." / ".$row['playerperteam']; ?></font></td>
</tr>
<?php
}
?>
<tr>
<td>» <a href="<?php echo $urltovwar; ?>war.php?action=nextaction&formgame=<?php echo $row['gameid']."#".$row['warid']; ?>">details</a><br><br></td>
</tr>
<?php
}
$vwardb->free_result($result);
}
else
{
?>
<tr>
<td align="center">No Next Actions</td>
</tr>
<?php
}
?>
</table>
<?php
if ($include == 1)
{
include_once ($vwar_root . "_footer.php");
}
?>
What would I do with it?
If you create a phpbox then put this code in it, it will display that information.
include('/path/to/nextactions.php');
Good Job IchBin
Thats got something up but I put in the absolute path in the nextactions.php now I get this error
Warning: main(): open_basedir restriction in effect. File(/www/war/includes/functions_common.php) is not within the allowed path(s): (/home/showno/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/showno/public_html/extra/nextactions.php on line 52
Warning: main(/www/war/includes/functions_common.php): failed to open stream: Operation not permitted in /home/showno/public_html/extra/nextactions.php on line 52
Fatal error: main(): Failed opening required '/www/war/includes/functions_common.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/showno/public_html/extra/nextactions.php on line 52
What have I done wrong
I think that is your host limiting PHP for security reasons. You could try an HTML article instead with an iframe that links to the php script. That might work.
Thanks IchBin so what is the code to do this?
Something like this: You can add scrolling/border and extra features to the iframe. But I don't remember the code for that. A google search will find you all that you need. :)
<iframe src="path/to/vwarfile.php"></iframe>
scrolling=no for no scrolling (scrolling is on by default)...
border=no for no border (border is on by default) :)
height=### for height
width=### for width :D
e.g.
<iframe src="/path/afwefw.php" scrolling=no border=no height=600 width=800></iframe>