All pastes #944718 Raw Edit

Something

public text v1 · immutable
·published 2008-03-16 10:43 UTC
rendered paste body
<?php
/*****************************************************************************\
|*
|*	ServerInfo Script V1.9 for Live for Speed S2
|*	========================================================
|*	Written by Sebastian "Octrin.VorTeX" Bauer, 2005-2008
|*	
|*
|*	This script has been tested with LiveForSpeed S2 hosts using versions:
|*		- 0.5P - 0.5Y
|*	
|*	For proper use of this script you need FTP or HTTP acces to the
|*	hostXXXXX.txt file. To access the server, enter the required information
|*	in the CONNECTION INFO field of the file _data_config.php. If you access the
|*	host.txt on a HTTP server that is not .HTACCESS protected, you don't need any
|*	password or user information, so keep this lines empty.
|*	Keep in mind, that accessing files on a remote server via HTTP requires the
|*	file to have CHMOD set to 666.
|*
|*	If you want to use the script for multiple servers copy the whole connection
|*	block as often as you want and increase the number in the brackets [].
|*	One example block of how this should look like for a 2nd server is already
|*	included inside the script. If you only use 1 server, remove the second
|*	connection block!
|*
|*	The Join2LFS-Link, which will be created with the servername requires the
|*	viewer of the website to have Join2LFS installed on the system.
|*	Join2LFS is a free browser extension developed by Holger Reitner (formerly
|*	known as "cr4cy!C3"). You can find the download using the following URL:
|*	http://lfstools.crazyice.net/pafiledb/pafiledb.php?action=file&id=57
|*
|*	Language table (list of available languages and their shortcuts):
|*	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|*	English				=	enu
|*	German				=	deu
|*	Danish				=	dan
|*	Spanish				=	esp
|*	French				=	fra
|*	Italian				=	ita
|*	Polish				=	plk
|*	Brazilian(Portugese)		=	ptb
|*	Swedish				=	swe
|*
|*
|*	Have fun with this script, if you have any questions, suggestions or
|*	found any bugs, please contact me at our forum, by ICQ or email.
|*
|*	You will find updates of this script and some other tools made by me
|*	at http://blog.gjl-network.net
|*
|*	ICQ: 	154112478
|*	eMail: vortex@gjl-network.net
|*
|*	If you want to stay informed about updates, you can sign in to my
|*	LFS script mailing list by writing an empty mail with the subject
|*	subscribe to lfsscript@gjl-network.net
|*
|*	IMPORTANT INFORMATIONS ABOUT THE USE OF THIS SCRIPT
|*	---------------------------------------------------
|*	The use of this script is free, also you are free to edit the script as
|*	you want (as long as you keep it running ;-) and keep my credits).
|*	Anyways please set a link to http://www.octrin-racing.net on your site
|*	which shows the link, either by using the file "octrin_88.jpg" which
|*	can be found in this archive or by using the file
|*	http://octrin.brainsware.org/images/octrin_88.jpg .
|*	
|*	----------------------------------------------------
|*
|*	Changes in Version 1.2:
|*	- Corrected an error in the output of the list of the allowed cars, which placed a comma at the end even if no car was following.
|*	- Optimized the script which creates the list of allowed cars.
|*
|*	Changes in Version 1.3:
|*	- Implemented Spanish translation (thanks to Dannel aka Erikdv)
|*	- Implemented French translation (thanks to Phlos)
|*	- Implemented Italian translation (thanks to Kira)
|*	- Implemented Polish translation (thanks to KamkoR)
|*	- Optimized language detection function.
|*	
|*	Changes in Version 1.4:
|*	- Corrected some character errors in the Polish translation
|*	- Made the script more customizable. It's now possible to select which information should be shown
|*	- Fixed one bug with the list of allowed cars when it is selected to show "All" if all cars are selected
|*	- Page title of the script will now include the server name (only if the script will be shown alone without a page including it
|*	- Changed the shortcut for Polish language according to the MS standards (using PLK instead of PL)
|*	- Fixed a small bug with the detection of the selected language
|*	
|*	Changes in Version 1.5:
|*	- Support of Swedish language (thanks to FEL)
|*	- Brazilian Portugese translation (thanks to JSCorrea)
|*	- Added the tracks "Fern Bay RallyX Green" and "Fern Bay RallyX Green Rev." which have been forgotten to be implemented :)
|*	- Completely re-wrote the main structure of the script to make the script now working with several servers at once.
|*	- Changed the way of setting the language: Language will now be set by variable in the configuration section of the script.
|*	
|*	Changes in Version 1.6:
|*	- Fixed wrong variable in car list generation. Now "All" will really be shown if it is set ;)
|*	- If race length is set to 0 minutes or laps now "Training" will be shown
|*	- Corrected default port in comment: of course it's 63392 and not 63396
|*	- Corrected misspelled variable $showLanuage to $showLanguage
|*	- Excluded configuration to seperate file _data_config.php
|*	- Possibility to show if server is public or private
|*
|*	Changes in Version 1.7:
|*	- Added content of LfS Patch S2T:
|*	  - 4 new track configs (AS North (rev.) and AS Grand Touring (rev.)
|*	  - 1 new car ( BF1 )
|*
|*	Changes in Version 1.8:
|*	- Added Danish language file. Thanks to Iceberg
|*	- Updated some comments of the script
|*
|*	Changes in Version 1.8a:
|*	- Corrected German translation for server stats (public / private)
|*
|*	Changes in Version 1.9:
|*	- Added new track from Patch Y "South City Chicane Route"
|*	- Added new car from Patch Y "Formula BMW"
|*	- Added additional check if file exists to avoid errors in output
|*
|*	----------------------------------------------------
|*	(C) 2005-2008 by Sebastian "Octrin.VorTeX" Bauer
|*
|*	Special thx fly out to:
|*	- Octrin.cr4zy!C3 for additional information
|*	  about the LfS color mapping.
|*	- All translators (Erikdv, Phlos, Kira, KamkoR, FEL and JSCorrea, Iceberg)
|*	- misjka for a lot of good suggestions :)
|*	- [SPTR] Dan! for his code changes for patch Y
|*
|*	====================================================
|*
|*	Updates and more stuff from me at: http://blog.gjl-network.net
|*	My LFS Mirror: http://lfs.gjl-network.net
|*
\********************************End of Comment********************************/


/****** PLEASE CHANGE ALL CONFIGURATION DATA IN THE FILE _data_config.php *****/


//////////////////////////////////////////////////////////////////////////////////////////////
// !!!DO NOT EDIT THE CODE BELOW THIS LINE IF YOU DO NOT EXACTLY KNOW WHAT YOU ARE DOING!!! //
//////////////////////////////////////////////////////////////////////////////////////////////

include "_data_config.php";
$serverCount = count($serverprot);
$c = 0;
while($c < $serverCount)
{	
	include setLanguage($showLanguage);
	$filepath[$c] = $serverprot[$c] . "://" . $ftpuser[$c] . ":". $ftppw[$c] . "@" . $serverip[$c] . $hostpath[$c] . "/host" . $lfsport[$c] . ".txt";
	
	/*$sock = @fsockopen($serverip[$c], $lfsport[$c], $errno, $errstr, 0.01);
	
	if (!$output)
	{
		$status = "offline";
	}
	else
	{
		$status = "online";
	}
	@fclose($output);
		
	if ($status == offline)
	{
		echo "Status: offline";
		break;
	}
	else */
	{
		if( !file_exists( $filepath[$c] ) )
		{
			echo "Server <span style=\"color: red;\">offline</span>";
		}
		else
		{
			$datei[$c] = @fopen($filepath[$c], r);

			if($datei[$c]==FALSE)
			{
				die "File access error!";
			}
			while(!feof($datei[$c]))
			{
				$zeile[$c] = $zeile[$c] . "\n" . fread($datei[$c], 4096);
			}
			fclose($datei[$c]);
			
			//echo "<font face=\"Courier New\" size=\"2\">$zeile</font><br><br>";  //can be enabled to get some kind of debug output ;-)
			
			$splitted[$c] = explode("\n", $zeile[$c]);
			
			$version[$c] = explode("=", $splitted[$c][1]);
			$version[$c] = trim($version[$c][1]);
			
			$status[$c] = explode("=", $splitted[$c][2]);
			$status[$c] = trim($status[$c][1]);
			
			$guests[$c] = explode("=", $splitted[$c][3]);
			$guests[$c] = trim($guests[$c][1]);
			
			$maxguests[$c] = explode("=", $splitted[$c][4]);
			$maxguests[$c] = trim($maxguests[$c][1]);
			
			$hostname[$c] = explode("=", $splitted[$c][5]);
			$hostname[$c] = trim($hostname[$c][1]);
			
			$pass[$c] = explode("=", $splitted[$c][6]);
			$pass[$c] = trim($pass[$c][1]);
			
			$track[$c] = explode("=", $splitted[$c][8]);
			$track[$c] = trim($track[$c][1]);
			
			$cars[$c] = explode("=", $splitted[$c][9]);
			$cars[$c] = trim($cars[$c][1]);
			
			$qual[$c] = explode("=", $splitted[$c][10]);
			$qual[$c] = trim($qual[$c][1]);
			
			$length[$c] = explode("=", $splitted[$c][11]);
			
			if(trim($pass[$c]) != "")
				$public[$c] = $strServerPrivate;
			else
				$public[$c] = $strServerPublic;
				
			if(trim($length[$c][1]) == "" || trim($length[$c][1]) == "0")
			{
				$length[$c] = $strTraining;
				$qual[$c] = $strNone;
			}
			else
			{
				if(trim($length[$c][0])=="hours")
				{
					if(trim($length[$c][1]) > 1)
						$length[$c] = trim($length[$c][1]) . " " . $strHours;
					else
						$length[$c] = trim($length[$c][1]) . " " . $strHour;
				}
				else if(trim($length[$c][0])=="laps")
				{
					if(trim($length[$c][1]) > 1)
						$length[$c] = trim($length[$c][1]) . " " . $strLaps;
					else
						$length[$c] = trim($length[$c][1]) . " " . $strLap;
				}
					
				if($qual[$c]=="1")
					$qual[$c] .= " " . $strMinute;
				else
					$qual[$c] .= " " . $strMinutes;
			}
				
			$i1 = 12;
			while($i1 <= count($splitted[$c]))
			{
				$racer[$c] = explode("=", $splitted[$c][$i1]);
				$racer[$c] = trim($racer[$c][1]);
				if(trim($racer[$c]!="host"))
				{
					$racer[$c] = get_racer($racer[$c]);	
					$online_racer[$c] .= $racer[$c] . "<br>";
				}
				$i1++;
			}
			$hostname_clear[$c] = get_clearHostname($hostname[$c]);
			$host[$c] = get_hostname($hostname[$c]);
			$status[$c] = get_onlineStatus($status[$c]);
			$cars[$c] = get_cars($cars[$c], $showInfo[$c][4], $showLanguage);
			$track[$c] = get_trackName($track[$c]);
		}
		
		if($host[$c]==NULL)
			$status[$c] = "<font color=\"red\">" . $strError_connect . "</font>";
		/*if($datei==FALSE && $host!=NULL)
			$status = "<font color=\"red\">" . $strError_file . "</font>";*/
		if($guests[$c]==0)
			$online_racer[$c] = "<i>" . $strNo_racer . "</i>";
		output($showInfo, $bgColor, $hostname_clear[$c], $host[$c], $status[$c], $version[$c], $guests[$c], $maxguests[$c], $track[$c], $cars[$c], $qual[$c], $length[$c], $online_racer[$c], $showLanguage, $public[$c]);
		$c++;
	}
}
//////////////////////////////////////////////////////////////////////////////////////////////
//            !!! ALL FUNCTIONS USED IN THE SCRIPT WILL BE BEHIND THIS LINE !!!             //
//////////////////////////////////////////////////////////////////////////////////////////////

/***************************************************\
|*	output()
|*	=========================
|*	This function formats all gained information and
|*	creates the output and also writes the output.
\***************************************************/
function output($showInfo, $bgColor, $hostname_clear, $host, $status, $version, $guests, $maxguests, $track, $cars, $qual, $length, $online_racer, $showLanguage, $strServerPub)
{
	include "_data_config.php";
	include setLanguage($showLanguage);
	
	echo "<body bgcolor = \"$bgColor\"><font face=\"Verdana\" size=\"2\">";
	echo $strHostname ;
	echo ": <b><a href=\"lfs://|$hostname_clear|0|S2|/\">$host</a></b><br>";
	echo $strStatus . ": <b>$status</b><br>";
	if($showInfo[8]==1)
		echo "$strServerPub<br>";
	if($showInfo[0]==1)
		echo $strVersion . ": $version<br>";
	if($showInfo[1]==1)
		echo $strUserConnected . ": $guests/$maxguests<br>";
	if($showInfo[2]==1)
		echo $strTrack . ": $track<br>";
	if($showInfo[3]==1)
		echo $strCars . ": $cars<br>";
	if($showInfo[5]==1)
		echo $strQualifying . ": $qual<br>";
	if($showInfo[6]==1)
		echo $strRacelength . ": $length<br><br>";
	if($showInfo[7]==1)
		echo $strRacersOnline . ": <br>$online_racer";
	echo "<br><br><br><br>";
	echo "</font></body>";
	
	return FALSE;
}

/***************************************************\
|*	setLanguage()
|*	=========================
|*	This will get the language string from the config.
|*	If no language string (e.g. "enu" or "deu") is
|*	supplied, English will be used by default.
\***************************************************/
function setLanguage($showLanguage)
{
	$lang = strtolower($showLanguage);	//Always convert the language shortcut to lower case characters
	if($lang=="")
		$lang = "enu";
	
	$LangSet = "lang/lang_" . $lang . ".php";
	
	if(is_file($LangSet)==false)
		$LangSet = "lang/lang_enu.php";
		
	return	$LangSet;
}

/***************************************************\
|*	get_trackName($track)
|*	=========================
|*	This function converts the short Track tag (e.g.
|*	BL1, KY2, SO2R and so on) to the complete name
|*	of the current track combination.
\***************************************************/
function get_trackName($track)
{
	///////////////////////////
	// BLACKWOOD
	///////////////////////////
	if($track=="BL1")
		$trackName = "Blackwood GP";
	if($track=="BL1R")
		$trackName = "Blackwood GP Rev.";
	if($track=="BL2")
		$trackName = "Blackwood RallyX";
	if($track=="BL2R")
		$trackName = "Blackwood RallyX Rev.";
	if($track=="BL3")
		$trackName = "Blackwood Car Park";
		
	///////////////////////////
	// SOUTH CITY
	///////////////////////////
	if($track=="SO1")
		$trackName = "South City Classic";
	if($track=="SO1R")
		$trackName = "South City Classic Rev.";
	if($track=="SO2")
		$trackName = "South City Sprint Track 1";
	if($track=="SO2R")
		$trackName = "South City Sprint Track 1 Rev.";
	if($track=="SO3")
		$trackName = "South City Sprint Track 2";
	if($track=="SO3R")
		$trackName = "South City Sprint Track 2 Rev.";
	if($track=="SO4")
		$trackName = "South City Long";
	if($track=="SO4R")
		$trackName = "South City Long Rev.";
	if($track=="SO5")
		$trackName = "South City Town Course";
	if($track=="SO5R")
		$trackName = "South City Town Course Rev.";
	if($track=="SO6")
		$trackName = "South City Chicane Route";
	if($track=="SO6R")
		$trackName = "South City Chicane Route Rev.";
		
	///////////////////////////
	// FERN BAY
	///////////////////////////
	if($track=="FE1")
		$trackName = "Fern Bay Club";
	if($track=="FE1R")
		$trackName = "Fern Bay Club Rev.";
	if($track=="FE2")
		$trackName = "Fern Bay Green";
	if($track=="FE2R")
		$trackName = "Fern Bay Green Rev.";
	if($track=="FE3")
		$trackName = "Fern Bay Gold";
	if($track=="FE3R")
		$trackName = "Fern Bay Gold Rev.";
	if($track=="FE4")
		$trackName = "Fern Bay Black";
	if($track=="FE4R")
		$trackName = "Fern Bay Black Rev.";
	if($track=="FE5")
		$trackName = "Fern Bay Rallycross";
	if($track=="FE5R")
		$trackName = "Fern Bay Rallycross Rev.";
	if($track=="FE6")
		$trackName = "Fern Bay RallyX Green";
	if($track=="FE6R")
		$trackName = "Fern Bay RallyX Green Rev.";
		
	///////////////////////////
	// AUTOCROSS
	///////////////////////////
	if($track=="AU1")
		$trackName = "Autocross";
	if($track=="AU2")
		$trackName = "Autocross Skid Pad";
	if($track=="AU3")
		$trackName = "Autocross Drag Strip";
	if($track=="AU4")
		$trackName = "Autocross 8 Lane Drag Strip";
		
	///////////////////////////
	// KYOTO
	///////////////////////////
	if($track=="KY1")
		$trackName = "Kyoto Ring Oval";
	if($track=="KY1R")
		$trackName = "Kyoto Ring Oval Rev.";
	if($track=="KY2")
		$trackName = "Kyoto Ring National";
	if($track=="KY2R")
		$trackName = "Kyoto Ring National Rev.";
	if($track=="KY3")
		$trackName = "Kyoto Ring GP Long";
	if($track=="KY3R")
		$trackName = "Kyoto Ring GP Long Rev.";
		
	///////////////////////////
	// WESTHILL
	///////////////////////////
	if($track=="WE1")
		$trackName = "Westhill International";
	if($track=="WE1R")
		$trackName = "Westhill International Rev.";
		
	///////////////////////////
	// ASTON
	///////////////////////////
	if($track=="AS1")
		$trackName = "Aston Cadet";
	if($track=="AS1R")
		$trackName = "Aston Cadet Rev.";
	if($track=="AS2")
		$trackName = "Aston Club";
	if($track=="AS2R")
		$trackName = "Aston Club Rev.";
	if($track=="AS3")
		$trackName = "Aston National";
	if($track=="AS3R")
		$trackName = "Aston National Rev.";
	if($track=="AS4")
		$trackName = "Aston Historic";
	if($track=="AS4R")
		$trackName = "Aston Historic Rev.";
	if($track=="AS5")
		$trackName = "Aston Grand Prix";
	if($track=="AS5R")
		$trackName = "Aston Grand Prix Rev.";
	if($track=="AS6")
		$trackName = "Aston Grand Touring";
	if($track=="AS6R")
		$trackName = "Aston Grand Touring Rev.";
	if($track=="AS7")
		$trackName = "Aston North";
	if($track=="AS7R")
		$trackName = "Aston North Rev.";
		
	return $trackName;
}

/***************************************************\
|*	get_racer($racername)
|*	=========================
|*	This function interprets the gained nickame of a
|*	racer on the server and converts the text format
|*	information from LfS (^1 = red, ^7 = white,
|*	^a = * and so on) to valid HTML code to be shown
|*	on the website.
\***************************************************/
function get_racer($racername)
{
	if(strstr($racername, "^")==FALSE)	// If no ^ is found for color changing, just use the normal racername
		$racer = "<font color=\"#cccccc\">" . $racername . "</font>";
	else
	{
		$racername = "^8" . $racername;		// Small workaround to avoid some problems while parsing racername
		$racername_split = explode("^", $racername);	
		
		$i = 0;
				
		while($i < count($racername_split))
		{
			if(strstr(substr($racername, 0, strlen($racername_split[$i])), "^")==TRUE)
			{
				$lfsCode = substr($racername_split[$i], 0, 1);
				
				// $racer .= "|lfsCode>"  . $lfsCode . "<lfsCode|";	// Line can be decommented to show, which LfS Codes are found
				
				$stringPart = substr($racername_split[$i], 1, strlen($racername_split[$i]));
				
				switch($lfsCode){
					case "0":		// BLACK
							$racer = $racer . "<font color=\"black\">" . $stringPart . "</font>";
						break;
					case "1":		// RED
							$racer = $racer . "<font color=\"red\">" . $stringPart . "</font>";	
						break;
					case "2":		// GREEN
							$racer = $racer . "<font color=\"#7CFC00\">" . $stringPart . "</font>";
						break;
					case "3":		// YELLOW
							$racer = $racer . "<font color=\"yellow\">" . $stringPart . "</font>";
						break;
					case "4":		// BLUE
							$racer = $racer . "<font color=\"blue\">" . $stringPart . "</font>";
						break;
					case "5":		// MAGENTA
							$racer = $racer . "<font color=\"#FF00FF\">" . $stringPart . "</font>";
						break;
					case "6":		// CYAN
							$racer = $racer . "<font color=\"#00FFFF\">" . $stringPart . "</font>";
						break;
					case "7":		// WHITE
							$racer = $racer . "<font color=\"white\">" . $stringPart . "</font>";
						break;
					case "8":		// GREY
							$racer = $racer . "<font color=\"#CCCCCC\">" . $stringPart . "</font>";
						break;
					case "a":	// ^a = *
							$racer = $racer . "*" . $stringPart;
						break;
					case "v":	// ^v = |
							$racer = $racer . "|" . $stringPart;
						break;
					}
			}
			$racer = "<font color=\"#cccccc\">" . $racer . "</font>";
			
			$i++;
		}
	}
	return $racer;
}

/***************************************************\
|*	get_clearHostname($hostname)
|*	============================
|*	This function formats the server string and
|*	returns a string without any color information
|*	for use in Join2LfS links used in the display
|*	of the servername.
\***************************************************/
function get_clearHostname($hostname)
{
	if(strstr($hostname, "^")==FALSE)	// If no ^ is found for color changing, just use the normal hostname
		$hostname_clear = $hostname;
	else
	{
		$hostname_split = explode("^", $hostname);
		
		$i = 0;
		
		while($i < count($hostname_split))
		{
			$hostname_clear .= substr($hostname_split[$i], 1, strlen($hostname_split[$i]));
			$i++;
		}
	}
	return $hostname_clear;
}

/***************************************************\
|*	get_hostname($hostname)
|*	=========================
|*	This function interprets the gained hostname and
|*	converts the text color information from LfS
|*	(^1 = red, ^7 = white and so on) to valid HTML
|*	code to be shown on the website.
\***************************************************/
function get_hostname($hostname)
{	
	if(strstr($hostname, "^")==FALSE)	// If no ^ is found for color changing, just use the normal hostname
		$host = "<font color=\"#cccccc\">" . $hostname . "</font>";
	else
	{
		$hostname_split = explode("^", $hostname);
		$i = 0;
				
		while($i < count($hostname_split))
		{
			if(strstr(substr($hostname, 0, strlen($hostname_split[$i])), "^")==TRUE)
			{
				$lfsCode = substr($hostname_split[$i], 0, 1);
				
				//$host .= "|lfsCode>"  . $lfsCode . "<lfsCode|";	// Line can be decommented to show, which LfS Codes are found
				
				$stringPart = substr($hostname_split[$i], 1, strlen($hostname_split[$i]));
				
				switch($lfsCode){
					case "0":		// BLACK
						$host = $host . "<font color=\"black\">" . $stringPart . "</font>";
						break;
					case "1":		// RED
						$host = $host . "<font color=\"red\">" . $stringPart . "</font>";
						break;
					case "2":		// GREEN
						$host = $host . "<font color=\"#7CFC00\">" . $stringPart . "</font>";
						break;
					case "3":		// YELLOW
						$host = $host . "<font color=\"yellow\">" . $stringPart . "</font>";
						break;
					case "4":		// BLUE
						$host = $host . "<font color=\"blue\">" . $stringPart . "</font>";
						break;
					case "5":		// MAGENTA
						$host = $host . "<font color=\"#FF00FF\">" . $stringPart . "</font>";
						break;
					case "6":		// CYAN
						$host = $host . "<font color=\"#00FFFF\">" . $stringPart . "</font>";
						break;
					case "7":		// WHITE
						$host = $host . "<font color=\"white\">" . $stringPart . "</font>";
						break;
					case "8":		// GREY
						$host = $host . "<font color=\"#cccccc\">" . $stringPart . "</font>";
						break;
					case "a":	// ^a = *
						$host = $host . "*" . $stringPart;
						break;
					case "v":	// ^v = |
						$racer = $racer . "|" . $stringPart;
						break;
					}
			}
			else
			{
				$host = $hostname_split[$i];
			}
			$host = "<font color=\"#cccccc\">" . $host . "</font>";
			$i++;
		}
	}
	return $host;
}

/***************************************************\
|*	get_onlineStatus($status)
|*	=========================
|*	This function simply interprets and formats the
|*	information about the server online status.
\***************************************************/
function get_onlineStatus($status)
{
	// FORMAT ONLINE STATUS
	if($status == "online" || $status == "ingame")
		$status = "<font color=\"green\">Online</font>";
	else
		$status = "<font color=\"red\">Offline</font>";
		
	return $status;
}

/***************************************************\
|*	get_cars($cars, $showAll, $showLanguage)
|*	=======================================
|*	This function reads out which cars are allowed
|*	on the current server. Afterwards the information
|*	will be interpreted to show the proper car name.
\***************************************************/
function get_cars($cars, $showAll, $showLanguage)
{
	include "_data_config.php";
	include setLanguage($showLanguage);
	$i = 0;
	$j = 0;
	$j2 = 0;
	if(trim($cars)=="11111111111111111111" && $showInfo[4] == 1)
		$carlist = $strAll;
	else
	{
		while($i < strlen($cars))
		{
			if($cars[$i]==1)
				$j++;
			$i++;
		}
		$i = 0;
		while($i < strlen($cars))
		{
			if($cars[$i]==1)
			{
				$j2++;
				switch($i){
					case 0:
						$carlist .= "XFG";
						break;
					case 1:
						$carlist .= "XRG";
						break;
					case 2:
						$carlist .= "XRT";
						break;
					case 3:
						$carlist .= "RB4";
						break;
					case 4:
						$carlist .= "FXO";
						break;
					case 5:
						$carlist .= "LX4";
						break;
					case 6:
						$carlist .= "LX6";
						break;
					case 7:
						$carlist .= "MRT";
						break;
					case 8:
						$carlist .= "UF1";
						break;
					case 9:
						$carlist .= "RAC";
						break;
					case 10:
						$carlist .= "FZ5";
						break;
					case 11:
						$carlist .= "FOX";
						break;
					case 12:
						$carlist .= "XFR";
						break;
					case 13:
						$carlist .= "UFR";
						break;
					case 14:
						$carlist .= "FO8";
						break;
					case 15:
						$carlist .= "FXR";
						break;
					case 16:
						$carlist .= "XRR";
						break;
					case 17:
						$carlist .= "FZR";
						break;
					case 18:
						$carlist .= "BF1";
						break;
					case 19:
						$carlist .= "FBM";
						break;
					}
			if($j2 < $j)
				$carlist .= ", ";
			}
			$i++;
		}
	}
	
	return $carlist;
}

?>