i have a previously written code which is giving following errors in some systems(servers) only.. and some servers it is running fine...code is written in PHP 5.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in c:\wamp\www\gyn_with_pin\blclasses.php on line 15
Fatal error: Cannot instantiate non-existent class: session in c:\wamp\www\gyn_with_pin\pin_index.php on line 4
The code goes like following...(file name 'blclasses.php')
Code: Select all
<?php
include_once("conf.php");
//Global string for current default dimension
$DefaultDimension="";
class TDimension
{
public $m_strName; // Name of the dimension.
public $m_arrValue; // Value of the dimension
function __construct($name, $value)
{
$this->m_strName = $name;
$this->m_arrValue = array();
if($name=='Time')
{
if(isset($value['year']))
$this->m_arrValue['year'] = $value['year'];
if(isset($value['month']))
$this->m_arrValue['month'] = $value['month'];
if(isset($value['day']))
$this->m_arrValue['day'] = $value['day'];
if(isset($value['hour']))
$this->m_arrValue['hour'] = $value['hour'];
if(isset($value['minute']))
$this->m_arrValue['minute'] = $value['minute'];
}
if($name=='Victim' || $name=='Attacker')
{
if(isset($value['ipaddress']))
$this->m_arrValue['ipaddress'] = $value['ipaddress'];
}
if($name=='Signature')
{
if(isset($value['rulename']))
$this->m_arrValue['rulename'] = $value['rulename'];
}
if($name=='Sensor')
{
if(isset($value['name']))
$this->m_arrValue['name'] = $value['name'];
}
}
};
class Dimension
{
public $m_tdInformation; // TDimension Object
public $m_strTableName; // Table Name
public $m_strFieldName; // Field Name
public $m_strColNameInFactTable; // Column Name
public $m_id;
public $m_arrDescription;
function __construct($tdInfo)
{
if(isset($tdInfo))
{
$this->m_tdInformation = $tdInfo;
if($tdInfo->m_strName=='Time')
{
$this->m_strTableName = 'time';
$this->m_strFieldName = 'time' ;
$this->m_strColNameInFactTable = 'time';
$this->m_id = 't_id';
}
if($tdInfo->m_strName=='Victim')
{
$this->m_strTableName = 'host';
$this->m_strFieldName = 'ipaddress' ;
$this->m_strColNameInFactTable = 'target';
$this->m_id = 'h_id';
$this->m_arrDescription = array('name','location','internal');
}
if($tdInfo->m_strName=='Attacker')
{
$this->m_strTableName = 'host';
$this->m_strFieldName = 'ipaddress' ;
$this->m_strColNameInFactTable = 'source';
$this->m_id = 'h_id';
$this->m_arrDescription = array('name','location','internal');
}
if($tdInfo->m_strName=='Signature')
{
$this->m_strTableName = 'rule';
$this->m_strFieldName = 'rulename';
$this->m_strColNameInFactTable = 'signature';
$this->m_id = 'ruleid';
$this->m_arrDescription =
//array('enabled','updatedto','impactid','severityid','description','typeid');
// Removing 'enabled', 'updatedto', 'description'
//array('impactid','severityid','typeid');
array();
}
if($tdInfo->m_strName=='Sensor')
{
$this->m_strTableName = 'sensor';
$this->m_strFieldName = 'name' ;
$this->m_strColNameInFactTable = 'analyzer';
$this->m_id = 'sensorid';
$this->m_arrDescription = array('ipaddr','listenport','hostname','description');
}
}
}
};
//This class is meant to be stored in $_SESSION
//It is required to maintain the state between various pages.
class Session
{
public $DefaultDimension;
public $m_arrTDimension;
public $Type; // current view ? pie, bar or table
public $m_strOrderBy; // sorthing field
public $m_strOrder; // descending or ascending
public function __construct()
{
if(isset($_SESSION['State']))
{
$State = $_SESSION['State'];
$this->DefaultDimension = $State->DefaultDimension;
$this->m_arrTDimension = array();
$this->Type = $State->Type;
$this->m_strOrderBy = $State->m_strOrderBy;
$this->m_strOrder = $State->m_strOrder;
}
else
{
$this->DefaultDimension = 'Victim';
$this->m_arrTDimension = array();
$this->Type = 'Table';
$this->m_strOrderBy = 'total_alerts';
$this->m_strOrder = 'desc';
}
}
}; Code: Select all
<?php
include_once("blclasses.php");
session_start();
$_SESSION['State'] = new Session();
?>
<html>
<body>
<img src="loading_wh.gif">
</body>
</html>