I need php help

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I need php help

Be careful with doing this. The way you have it currently setup I could easily display any file on your file system (including passwords, etc).

-Andrew Riley

I need php help

I am having some problem with the ?die()? statement. I want to use it to build in rudimentary error handling mechanisms. But I know, particularly in mid-sized and large applications, this method isn?t flexible enough. Right now I am using this code.

class FileReader{
var $file;
var $fileDir='fileDir/';
function FileReader($file){
if(!file_exists("{$this->fileDir}{$file}.php")){
trigger_error('File '.$file.' not found',E_USER_WARNING);
}
$this->file=$file;
}
function getContent(){
if(!$content=file_get_contents("{$this->fileDir}{$this->file}.php")){
trigger_error("Unable to read file contents",E_USER_WARNING);
}
return $content;
}
}

How I can make improvement.. any suggestion?

-----------------------
digital certificates

Stalk me!

Recommended Reading