Пример #1
0
$con = ccdc::pconnect();

mysql_select_db('ccdc');

print "Number of teams: " . ccdc::numTeams($con) . "\n";

print "Number of services running: " . ccdc::numServices($con) . "\n";


$activeservices = ccdc::getActiveServices($con);
while($row = mysql_fetch_array($activeservices, MYSQL_ASSOC))
{
	// Execute: poller host user pass
	$status = exec($basedir . $row['poller'] . " " . $row['host'] . " " . $row['user'] . " " . $row['pass']);

	if(trim($status) == "SUCCESS")
	{
		$query = "UPDATE services SET attempts = attempts + 1, success = success + 1, lastcheck = 1 WHERE name = '" . $row['name'] . "' AND teamid = " . $row['teamid'];
		mysql_query($query);
	}
	else
	{
		$query = "UPDATE services SET attempts = attempts + 1, lastcheck = 0 WHERE name = '" . $row['name'] . "' AND teamid = " . $row['teamid'];
		mysql_query($query);
	}
}

ccdc::dbclose($con);

?>
Пример #2
0
<html>
<head>
<?
require('../class/ccdc.class.php');

$con = ccdc::pconnect();

mysql_select_db('ccdc');

$numteams = ccdc::numteams($con);
$currteam = $_GET['team'];

$here = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];

if(empty($currteam))
{
	header('location:?team=1');	
}
else
{
	if($currteam < $numteams)
	{
		print '<meta http-equiv="refresh" content="15;url=http://' . $here . '?team=' . ($currteam +1) . '">';
	} 
	else
	{
		print '<meta http-equiv="refresh" content="15;url=http://' . $here . '?team=1">';
	}
}

// Get current team's id