[eluser]consigliere[/eluser]
I tried and PHP throws this error:
Quote:Fatal error: Call to a member function library() on a non-object in Vehicles.php on line
Here are my files based on
http://codeigniter.com/wiki/Calling_CI_m...de_script/
config_constants.php
Code:
<?php
if( ! $system_folder)
$system_folder = "system";
if( ! $application_folder)
$application_folder = "application";
if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
{
$system_folder = str_replace("\\", "/", realpath(dirname(__FILE__))).'/'.$system_folder;
}
define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
define('FCPATH', __FILE__);
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('BASEPATH', $system_folder.'/');
if (is_dir($application_folder))
{
define('APPPATH', $application_folder.'/');
}
else
{
if ($application_folder == '')
{
$application_folder = 'application';
}
define('APPPATH', BASEPATH.$application_folder.'/');
}
if ( ! defined('E_STRICT'))
{
define('E_STRICT', 2048);
}
?>
ci_model_remote_open.php
Code:
<?php
require_once('config_constants.php');
require(BASEPATH.'codeigniter/Common'.EXT);
set_error_handler('_exception_handler');
set_magic_quotes_runtime(0); // Kill magic quotes
$CFG =& load_class('Config');
$LANG =& load_class('Language');
if (floor(phpversion()) < 5)
{
load_class('Loader', FALSE);
require(BASEPATH.'codeigniter/Base4'.EXT);
}
else
{
require(BASEPATH.'codeigniter/Base5'.EXT);
}
// instantiate a "fake" controller
$CI = load_class('Controller');
require_once(BASEPATH.'libraries/Form_validation'.EXT);
?>
Vehicles.php
Code:
<?php
class Vehicles
{
function __construct()
{
require_once("deca/utils/CodeIgniter_1.7.2/ci_model_remote_open.php");
require_once("deca/utils/CodeIgniter_1.7.2/system/libraries/Form_validation.php");
}
function sendCommands($param) {
if (isset($_SESSION['USER_PWD'])) {
// CodeIgniter Code
$system_folder = "CodeIgniter/system";
$CI->load->library('form_validation');
if ($CI->form_validation->run() == FALSE)
{
return "ERROR";
}
else
{
return "TRUE";
}
}
function __destruct()
{
$this->DB->close();
}
}
?>