Aug 09, 2011 Errors Only Visible To Web Developer
If you're a web developer, you know that your code is relying on a lot to go right. You debug & test to get it right where it's prime and error-proof, yet even with all this time spent doing this you can still find yourself with the occasional error printing to your visitors.
Not only is this an embarrassment and can present confusion to your visitors, it can also be a security risk.
With this little snippet at the top of your pages, you can be sure that no one but you sees the errors that may happen on your sites.
Just add the I.P.'s you use to develop from (work, home, etc...) to the $errorIP array and you're good to go.
$errorIP = array("11.11.11.11", "00.00.00.00");
if(in_array($_SERVER['REMOTE_ADDR'], $errorIP)):
ini_set('display_errors','On');
else:
ini_set('display_errors','Off');
endif;











Another thing you could try doing, in addition to this or instead of, is to wrap your error's in some JS that will print it to the browser console instead of to the screen to even further protect your visitors from seeing it.
@Eddie Monge Write it up & I'll include it on here as an option.
Nice post.