<? DEW-CODE.COM  
Dew-Code
Welcome, Guest
Please Login or Register.    Lost Password?
Printing sensitive variables on a live site. (1 viewing) (1) Guest
Post your PHP related questions or observations here. Code snippets are always welcome.
Go to bottom Post Reply Favoured: 0
TOPIC: Printing sensitive variables on a live site.
#600
Dewed (Admin)
Admin
Posts: 534
graph
User Online Now Click here to see the profile of this user
Dew-Code.com
Printing sensitive variables on a live site. 1 Year, 10 Months ago Karma: 9  
I often am asked to make tweaks to a live site which is risky for numerous reasons. Foremost, if I haven't had enough coffee, I might make a simple typo, casuing a big fat glorious error for everyone to see. Secondly, it's often neccesary to print out arrays, or variables to see their values.. sometimes these variables contain sensitive info that you don't want anyone else to see.


Here is a simple way to print out info for a particular IP address ..

Code:

if ($_SERVER['REMOTE_ADDR'] == "123.123.123"){ echo "<hr><pre><textarea>" . $some_variable ."</textarea></pre></hr>"; }
or for an array, use the print_r function with the true flag..
Code:

if ($_SERVER['REMOTE_ADDR'] == "123.123.123"){ echo "<hr><pre><textarea>" . print_r($some_variable, true) ."</textarea></pre></hr>"; }
Obviously you'll need to determine your own IP address, and use an existing variable or array name.
 
Report to moderator   Logged Logged  
 
Nothing to it but to Dew it !
Dew-Code.com
  The administrator has disabled public write access.
Go to top Post Reply
get the latest posts directly to your desktop
Outsource your projects to thousands of programmers at
ScriptLance.com
Newsflash
Interested in
advertising?

This space for rent!

Sign up for PayPal and start accepting credit card payments instantly.
Copyright Dew-Code 2008