|
Posted by Rik Wasmus on 09/01/07 03:20
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'] =3D "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.
> 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, regardele=
ss =
of who views the page (requests vary, and allthough I try I sadly cannot=
=
envision every single combination of requestvariables). If you want on t=
he =
fly debugging, maybe set and use a custom cookie just for you:
<?php
if (isset($_COOKIE['mydebugname']) && =
$_COOKIE['mydebugname']=3D=3D'mydebugsecret') {
echo $level1, '_', $level2, '_', $imageNO, ' ', $display;
}
?>
Set the cookie somewhere manually or on a protected page.
-- =
Rik Wasmus
My new ISP's newsserver sucks. Anyone recommend a good one? Paying for =
quality is certainly an option.
Navigation:
[Reply to this message]
|