Jump to content

Undefined Object??


onlyican

Recommended Posts

Hey guys

I have an inc_header.php file
As follows

[code]
<?php
session_start();

error_reporting(2047);

require("../includes/globals.php");


require("../includes/MySQL.php");
$DB = new MySQL;
$DB->connect();

require("../includes/Sessions.php");
$in = $_POST;
$user = new Sessions;

$user->get_current_session();

require("../includes/functions.php");

$left_links = isset($left_links) ? $left_links : "";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Site Admin</title>
<link href="../css/admin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id='PageFrame'>

<div id='Logo'>
</div>
<div id='LeftLinks'>
<?php
require("includes/inc_left_nav.php");
?>
</div>

<div id='Content'>
[/code]

And I am getting the following error
[quote]
Notice: Use of undefined constant object - assumed 'object' in W:\www\stontronics\administration\includes\inc_header.php on line 15
[/quote]

Line 15 is
$user = new Sessions;

So I had a look at sessions.php
and I saw something I have not seen before


And the file Sessions.php is like this

[code]
<?php


class Sessions
{
var $db = object;
var $input = array();
var $errors = array();
var $me = array();
var $session = array();

function Sessions()
{
global $DB, $in, $lib, $email, $debug;

$this->db = $DB;
$this->input = $in;
$this->session = &$_SESSION;
$this->lib = $lib;

$this->email = $email;
$this->debug = $debug;
$this->debug = false;
}
?>
[/code]

The word object;

I have checked this on PHP 5.1.1 and 4.4.3

Anyone know a way around this.

Note:
In the function Sessions()
where we add
$this->db = $DB;

And From the inc_header
$DB = new MySQL;

Now

Without having to Change the error_reporting
How do I clear this error message
Link to comment
https://forums.phpfreaks.com/topic/30239-undefined-object/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.