|
Posted by Jerry Stuckle on 09/01/07 03:29
Rik Wasmus wrote:
> On Fri, 31 Aug 2007 23:45:54 +0200, Christian Aastorp wrote:
>
>>
>> I'm a newbie with php, but experienced with other languages. I'm
>> maintaining a small site written in php. To ease debugging and updates
>> I've used an onscreen reference to indicate identity of included files
>> etc.
>>
>> I don't really want this reference to be visible to anyone but myself.
>> So I searched the manual and found some promising predefined variables
>> that I used in this code snippet:
>>
>> <?php
>> if ($_SERVER['REMOTE_ADDR'] = "127.0.0.1") {
>> echo $level1, '_', $level2, '_', $imageNO, ' ', $display;
>> }
>> ?>
>>
>> This worked spllendidly when I tested running our site locally using
>> the XAMPP-bundle. But when I copied the code out to the real server it
>> seems that all clients are found at 127.0.0.1!
>
> Hmmmz, normally this can happen if you mistakingly include files by HTTP
> rather then by the normal filesystem.
>
Alternatively, is there a possibility there's a proxy involved here? I
saw that happen one time - all the log entries showed 127.0.0.1 as the
client address... Customer didn't even realize he could get client ip
numbers (for whatever good they do).
>> I'm sure there are lots of better ways both to fix my code, and
>> especially totally different ways to do what I'm trying to achive, any
>> suggestions very welcome!
>
> If debugging is needed, I'd normally try logging it to a file,
> regardeless of who views the page (requests vary, and allthough I try I
> sadly cannot envision every single combination of requestvariables). If
> you want on the fly debugging, maybe set and use a custom cookie just
> for you:
>
> <?php
> if (isset($_COOKIE['mydebugname']) &&
> $_COOKIE['mydebugname']=='mydebugsecret') {
> echo $level1, '_', $level2, '_', $imageNO, ' ', $display;
> }
> ?>
>
> Set the cookie somewhere manually or on a protected page.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|