Jump to content

find out if error when a file was included


jasonc

Recommended Posts

Say I have...

 

<?
echo("do something");
include("include_file.php");
echo("do something else");
?>

 

include_file.php

<?
$a_$string = "a string";
echo($a_string);
?>

 

I have put an error in the include_file.php  an extra $ in the variable name.

 

The first script would kick up an error that there is a problem with file  include_file.php  as line 3 or what ever the line may be.

 

How can I have it so I can choose what the error message is, say a cryptic code and the line number without having the file names show as this is showing up my hidden includes folder and the file name which means that someone may try to visit this page alone and this can cause security issues.

 

Adding in extra lines to every file to see if it is being use correctly a bit like sessions is not an option although I have looked at it as I have houndreds of files to alter in this case.

 

 

I have just tried this instead of the top script but I does not show the secret code on error

<?
echo("top");
@include("dummy.php") or die("secreterrorcode123");
echo("bottom");
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.