<?php
function getBadgeByID($id)
{
	$id_lines  = file(getcwd()."/queries/badge-id.list");
	$name_lines  = file(getcwd()."/queries/badges.list");
	foreach ($id_lines as $key => $value)
	{
		if ($id == intval($value))
			return $name_lines [$key];
	}
}

function getBadgeNameByID($id)
{
	$id_lines  = file(getcwd()."/queries/badge-id.list");
	$name_lines  = file(getcwd()."/queries/badges_3.list");
	foreach ($id_lines as $key => $value)
	{
		if ($id == intval($value))
			return $name_lines [$key];
	}
}

function getBadgeCount()
{
	$lines  = file(getcwd()."/queries/badges.list");
	return count($lines);	
}

function getBadge($id)
{
	$lines  = file(getcwd()."/queries/badge-id.list");
	return $lines[$id];
}

function getCountBadge($id)
{
	$id_lines  = file(getcwd()."/queries/badge-id.list");
    $i = 0;
    foreach ($id_lines as $key => $value)
	{
		if (intval($id) == intval($value))
			return $i;
    $i++;
    }
}


?>