Jump to content
php.lv forumi

skripts.


naziic
 Share

Recommended Posts

Nu lieta tāda, ka man ir normāls cs server monitoring skripts, bet viņā ir viena problēma, kad viņš atjauno informāciju, t.i playerus, laiku u.c tad visa lapa kurā viņs ir iesaistīts refrešojās.

<?php
error_reporting(E_ALL & !E_NOTICE);
$server = array();
include_once("status_config.php");
include_once("status_class_PQ.php");
include_once("status_xtemplate.php");

foreach($server as $conf){
unset($pq,$pqinfo,$tpl);
$pq = PQ::create($conf); //$conf is a array or string
if($debug){
$pq->DEBUG =1;
echo "<code><pre>";
}
$pqinfo = $pq->query(array('info','rules','players'));
if(!@$pqinfo['ping']) $pqinfo['timeout'] =1; else $pqinfo['timeout'] = 0;
if($debug){
echo "</pre></code>";
}
if(is_readable($conf['template']))
{
$tpl = new XTemplate($conf['template']);
$tpl->assign($conf);
$tpl->assign($pqinfo);
if($pqinfo['timeout'])
	{
	$tpl->parse("MAIN.TIMEOUT");
	}
else
	{
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
	foreach($pqinfo['players'] as $plr)
		{
		unset($player);//make sure w will not get values from previous row
		$player['player_name'] = $plr['Niks'];
		$player['player_id'] = $plr['id'];
		$player['player_kills'] = $plr['kills'];
		$player['player_time'] = $plr['onlinetime']; //seconds
		$player['player_time_min'] = date("H:i:s",$plr['onlinetime']-3600); //seconds, need to fix it
		$tpl->assign($player);
		$tpl->parse("MAIN.STATUS.PLAYERS.PLAYER");
		}
	$tpl->parse("MAIN.STATUS.PLAYERS");
////////////////////////////////////////////////////////////////////////////

	$tpl->parse("MAIN.STATUS");
	}

if($showall || $debug) // for debug mode and also getting all available values
	{	
	echo "<code><pre>";
	print_r($pqinfo);
	echo "</pre></code>";

	}
$tpl->parse("MAIN");
$tpl->out("MAIN");
}
else
{		echo "ERROR: Template file ".$conf['template']." - failed to open file, check permissions or check if file exist";
}
}



?>

varbū kāds var palīdzēt? php neesmu nekāds kings... liels paldies jau iepriekš.

Link to comment
Share on other sites

es tikaj nesaprotu ko tu veelies panaakt, tev vajag laj tikaj siis te attieciigais skripts refreshojas?? bet paareejaa lapa nee?! taa lajkam ja?

jā, tas būtu ļoti labi, savādāk lasot, ziņas u.c lapa refreshojaas.. var jau darīt tā, ka to skriptu uzliek uz skripts.php un sasaista ar iframe, tad pats skripts refreshotos, bet itka gribu lai skripts ir pašā index.php lapā

Edited by naziic
Link to comment
Share on other sites

NU vis elementaaraakais variants buutu ar iframe tajsiit!!!!

Kaada atskiriba kur darbojas tas skripts?? vaj index.php vaj skripts.php??

tak panjem index.php uztajsi atsevisku iframe un miers i probleema atrisinaata!

ai nulapi, taisiisu ar iframe, bet tomer kads nevar pateikt, vnk intreses pec, lai citrez ja vajag..

Link to comment
Share on other sites

 Share

×
×
  • Create New...