TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,970
  • Latest: bynw
Stats
  • Total Posts: 196,061
  • Total Topics: 21,338
  • Online today: 234
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 127
  • Total: 128
  • lurkalot

Virtual War (Vwar)

Started by Amay_Zing, April 24, 2006, 04:40:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Amay_Zing

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.

IchBin

Did you try using a phpbox block and including it?

Amay_Zing

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&amp;oppid=<?php echo $row['oppid']; ?>"><?php echo $row['oppnameshort']; ?></a>
</td>
</tr>
<tr>
<td>&raquo; <?php echo date($longdateformat, $row['dateline']); ?></td>
</tr>
<!-- details start
<tr>
<td>&raquo; <?php echo $row['matchtypename']; ?></td>
</tr>
<tr>
<td>&raquo; <?php echo $row['gametypename']; ?></td>
</tr>
details end -->
<?php
if ($showirc == 1 && !empty($row['oppircnetwork']) && !empty($row['oppircchannel']))
{
?>
<tr>
<td>&raquo; 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>&raquo; Participants: <font color="<?php echo ($parts >= $row['playerperteam']) ? "green" : "red"; ?>"><?php echo $parts." / ".$row['playerperteam']; ?></font></td>
</tr>
<?php
}
?>
<tr>
<td>&raquo; <a href="<?php echo $urltovwar; ?>war.php?action=nextaction&amp;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?

IchBin

If you create a phpbox then put this code in it, it will display that information.

include('/path/to/nextactions.php');

Amay_Zing

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

IchBin

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.

Amay_Zing

Thanks IchBin  so what is the code to do this?

IchBin

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>

Moocat

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>

This website is proudly hosted on Crocweb Cloud Website Hosting.