Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ')'
in c:\inetpub\wwwroot\session.php on line 19
can anyone tell me what is wrong with this code???
<?
// Define the Session class
class Session
{
// Define the properties:
var $sqlhost="localhost";
var $sqluser="root";
var $sqlpass="";
var $sqldb="ecommerce";
var $linkid;
var $seshid;
var $sessdata;
var $err;
var $err_no;
var $expire_time=900; // length of time until expiration in seconds
var $userid;
// Define the methods:
function Session($this->seshid,$this->userid=0)
{
// connect to MySQL
$this->linkid=mysql_connect($this->sqlhost,$this->sqluser,$this->sqlpass);
// verify connection made
if (!$this->linkid) // was not able to connect
{
$this->err=mysql_error();
$this->err_no=101;
return;
}
// select database
$result=mysql_select_db($this->sqldb,$this->linkid);
if (!$result) // unable to select db
{
$this->err= mysql_error();
$this->err_no=102;
return;
}
// check to see if verifying session or creating session
if(!$this->seshid) // seshid 0 so creating
{
$current=time();
$random=$this->userid . $current;
$this->seshid=md5(random);
$query="insert into actsessions
values('$this->seshid','$this->userid',
$current)";
$result=mysql_query($query);
if (!$result)
{
$this->err= mysql_error()";
$this->err=104;
return;
}
// finished session create return to script
$this->err_no=0;
return;
}
// not new session, verify
$result=mysql_query("SELECT * FROM actsessions
WHERE seshid='$this-> seshid'");
if (!$result) // select failed
{
$this->err= mysql_error();
$this->err_no=103;
return;
}
// verify valid data returned
$numrows=mysql_num_rows($result);
if (!$numrows) // no rows returned, seshid not valid
{
$this->err="Session id not valid";
$this->err_no=201;
return;
}
//get session data
$this->sessdata=mysql_fetch_row($result);
$not_expired=$this->VerifyTime();
if (!$not_expired) // too much time has passed since last access
{
$this->err="Session has expired";
$this->err_no=202;
return;
}
$this->ResetTime(); // reset lastused to current
$this->CleanUp(); // remove expired sessions
$this->err_no=0;
}
function VerifyTime()
{
$current=time(); // get current UNIX timestamp
// check if the session has expired
if ($this->sessdata[lastused]+$this->expire_time<$current)
{
return 0;
}
return 1;
}
function ResetTime()
{
$current=time(); // get current UNIX timestamp
$query="update actsessions ";
$query.="set lastused=$current ";
$query.="where seshid='$this->seshid'";
$result=mysql_query($query);
}
function CleanUp()
{
$current=time();
$still_valid=$current-900;
$query="delete from sessions where lastused<$still_valid";
$result=mysql_query($query);
}
} // end of class definition
?>