All pastes #290479 Raw Edit

Mine

public text v1 · immutable
#290479 ·published 2006-12-24 01:21 UTC
rendered paste body
<?php

//
// JOIN MESSAGE
//
global $settings;
if ($settings['onjoinmsg'] == "yes")
{
	//$this->sendMessage($data['id'],'Hello! I\'m the Doctor.');
	//$this->sendMessage($data['id'],'Welcome to '.$server.'!');
	
	$list = new BZFlag_Info();
	$list_array = $list->serverlist();
		
	$description = '';	
	foreach ($list_array as $key => $stuff)
	{
		if ($list_array[$key]["serverport"] == $server)
		{
			$description = $list_array[$key]["description"];
		}
	}
	if (intval($description) == 0) { $description = $server; }
	if (intval($server) == 0) { $description = "some server"; }
	$this->sendMessage($data['id'],'Welcome to '.$description.'!');
			
	if ($this->owner($player) == 1)
	{
		$this->sendMessage($data['id'],'Welcome owner '.ucfirst($player).'!');
	}
	if ($data['isAdmin'])
	{
		$this->sendMessage($data['id'],'Welcome admin '.ucfirst($player).'!');
	}
	if (!$data['isVerified'])
	{
		$this->sendMessage($data['id'],'Register at my.bzflag.org/bb!');
	}
	
	if ($settings['joinmsg'] != "none")
	{
		$this->sendMessage($data['id'],$settings['joinmsg']);
	}

	global $commands;
	$message = "Commands:";
	foreach ($commands as $cmd)
	{
		$message .= " $cmd";
	}
	$message .= ".";
	$this->sendMessage($data['id'],$message);
}
if ($settings['onjoinmsg'] == "no" && $settings['joinmsg'] != "none")
{
	$this->sendMessage($data['id'],$settings['joinmsg']);
}

//
// USER DATABASE ADD
//

/*$lower_nick = strtolower($player);
$user_file = fopen('users.txt', 'r');
$user_array = fgets($user_file);
fclose($user_file);

$un_user_array = unserialize($user_array);
$found = false;

foreach ($un_user_array as $key => $stuff)
{
	if ($stuff['name'] == $lower_nick)
	{
		//Join Count Update
		//$join_count = $stuff['join_count'];
		//$stuff['join_count'] = $join_count + 1;
		
		//$stuff['join_count'] += 1;
		
		$un_user_array[$key]['join_count'] += 1;
		
		$found = true;
		//echo "\nUPDATING USER: '$lower_nick' join_count...";
	}
}

if (!$found)
{
	$spot = $key+1;
	$un_user_array[$spot]['name'] = $lower_nick;
	$un_user_array[$spot]['join_count'] = 1;
	$un_user_array[$spot]['kill_count'] = 0;
	$un_user_array[$spot]['death_count'] = 0;
	$un_user_array[$spot]['flag_count'] = 0;
	$un_user_array[$spot]['self_kill_count'] = 0;
	//echo "\nAdding user '$lower_nick' ...";
}

//$user_array = serialize($un_user_array);
$user_file = fopen('users.txt', 'w') or die("Error!!");
fwrite($user_file, serialize($un_user_array));
fclose($user_file);*/

//$mysqli->query("CREATE TEMPORARY TABLE myCity LIKE City");
//SELECT * FROM Users WHERE Callsign='test'
$rs = $this->db->Execute('select * from Users where Callsign="'.$player.'"');
$row = $rs->FetchRow();
if (sizeof($row) == 0)
{
	$record["Callsign"] = $player;
	$insertSQL = $db->AutoExecute("Users", $record, 'INSERT'); 
} else {
	$rs = $db->Execute('select * from Users where Callsign="'.$player.'"');
	$row = $rs->FetchRow();
	print_r($row);
	$join_count = $row["Joins"];
	$record["Joins"] = $join_count + 1;
	$db->AutoExecute('Users',$record,'UPDATE', "Callsign = '".$player."'");

}
		
?>