jasonc Posted October 29, 2010 Share Posted October 29, 2010 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"); ?> Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 29, 2010 Share Posted October 29, 2010 You should not have errors being displayed to the screen on a live site. They should be logged instead. Quote Link to comment Share on other sites More sharing options...
jasonc Posted October 29, 2010 Author Share Posted October 29, 2010 all i have done so far is place a @ before all include's but this means i do not know if there was an error or where it is, also the user does not know that something went wrong either. how do i log anyway Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 29, 2010 Share Posted October 29, 2010 Depends on your hosting provider. You'd enable it either in your php.ini file, or possibly through .htaccess after making sure there's a log file that can be written to by PHP. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.