Unexpected Parse Error

Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in C:xampphtdocsstatuslol.php on line 59

The code:

[code]$lang=“en”; // Language (“en” - english, “ru” - russian)
$title=“xx”; // Insert the title of your server here
$host=“xx”; // HOST for Character database
$user=“xx”; // USER for Character database
$password=“xx”; // PASS for Character database
$db=“xx”; // NAME of Character database
$hostr=“xx”; // HOST for Logonserver database
$userr=“xx”; // USER for Logonserver database
$passwordr=“xx”; // PASS for Logonserver database
$dbr=“accounts”; // NAME of Logonserver database
$database_encoding = ‘CP1251’; // Set encoding
$img_base = “img/”; // Image dir
$server = “xx”; // Ascent Server Address
$port = “8093”; // Ascent Server Port
$lock_acc=0; // Lock created account to IP address (1 - on, 0 - off)
$lock_reg=0; // Registration only one (or more) account from one IP address
// 0 - not limit, 1 - one acc, 2 - two acc, etc…
class DBLayer
{
var $link_id;
var $query_result;
var $saved_queries = array();
var $num_queries = 0;

function DBLayer($db_host, $db_username, $db_password, $db_name)
{
    $this->link_id = @mysql_connect($db_host, $db_username, $db_password, true);

    if ($this->link_id)
    {
        if (@mysql_select_db($db_name, $this->link_id))
            return $this->link_id;
        else
            error('Unable to select database. MySQL reported: '.mysql_error(), __FILE__, __LINE__);
    }
    else
        error('Unable to connect to MySQL server. MySQL reported: '.mysql_error(), __FILE__, __LINE__);
}

function make_players_array(){
global $host, $user, $password, $db, $database_encoding, $pl_array;
$i=0;
$ascent_db = new DBLayer($host, $user, $password, $db);
$ascent_db->query(“SET NAMES $database_encoding”);
$query = $ascent_db->query("SELECT * FROM characters WHERE online=‘1’ ORDER BY name");
while($result = $db->fetch_assoc($query))
{
$char_data = ($result[‘level’]);
$char_gender = ($result[‘gender’]);
$res_pos=get_zone_name($result[‘mapId’], $result[‘positionX’], $result[‘positionY’]);

$pl_array[$i] = Array($result[‘name’], $result[‘race’], $result[‘class’], $char_data, $res_pos, $char_gender);
$i++;
}
$ascent_db->close();
unset($ascent_db);
return $i;
}

$onlineplayers=make_players_array();

if (!$sort = &$_GET[‘s’]) $sort=0;
if (!$flag = &$_GET[‘f’]) $flag=0;
if ($flag==0) { $flag=1; $sort_type=’<’; }
else { $flag=0; $sort_type=’>’; }
$link=$_SERVER[‘PHP_SELF’]."?f=".$flag."&s=";

if (!empty($pl_array))
{
usort($pl_array, create_function(’$a, $b’, ‘if ( $a[’.$sort.’] == $b[’.$sort.’] ) return 0; if ( $a[’.$sort.’] ‘.$sort_type.’ $b[’.$sort.’] ) return -1; return 1;’));
}

$list="";
$i=0;
while ($i < $onlineplayers)
{
$name=$pl_array[$i][0];
$race=$pl_array[$i][1];
$class=$pl_array[$i][2];
$res_race = $def[‘character_race’][$race];
$res_class = $def[‘character_class’][$class];
$lvl=$pl_array[$i][3];
$loc=$pl_array[$i][4];
$gender=$pl_array[$i][5];
$list.= "



$name
$res_race
$res_class
$lvl
$loc
";
$i++;
}

if (test_realm())
{
$title.=(’ (’.$onlineplayers.’ ‘.$text[“playerson”].’)’);
} else
{
$title.=(’ '.$text[“off”]);
}
}
?>[/code]

Basically what I want this script to do

  • go to the database I have specified
  • check the ‘accounts’ db
  • and everyone with online=1 is added up
  • Everyone who is online is displayed on a page

If anyone could show me a easier way id be very grateful!

Thanks.

Which line is line 59?

Sponsor our Newsletter | Privacy Policy | Terms of Service