User IP Address from LC Server?

Phil Davis revdev at pdslabs.net
Thu Apr 27 21:06:05 EDT 2017


Hi Rick,

I believe that would be found in $_SERVER["REMOTE_ADDR"] .

Here is a simple way to see what's in the $_SERVER array:

1) Put the following code in a text file - I'll call it "globals.lc":

    <?lc
    put the keys of $_SERVER into tList
    sort lines of tList
    repeat for each line tKey in tList
         if $_SERVER[tKey] is an array
         then put "[" & tKey & "]" & CR after tOutput
         else put tKey && "=" && $_SERVER[tKey] & CR after tOutput
    end repeat

    -- do this so the output will look right in browser or from msg box
    if "LiveCode" is not in $_SERVER["HTTP_USER_AGENT"] then replace CR
    with "<BR>" in tOutput

    put tOutput
    ?>

2) Upload the file to the folder on your LC server where web pages go.

3) Go to its URL - e.g.  go url "http://mywebsite.com/globals.lc"


That should show you everything in the $_SERVER global.

You can do something similar to see what's in the various other server 
globals, all of which begin with "$_" - check the dictionary for more 
info on those.

HTH -
Phil Davis



On 4/27/17 5:21 PM, Rick Harrison via use-livecode wrote:
> After looking at a bunch of entries in the LC Dictionary
> I can’t find anything that tells me how I can get the
> IP of a User who has logged into my LC Server website.
>
> Does anyone out there know how to do this with LC?
>
> Thanks in advance!
>
> Rick
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

-- 
Phil Davis




More information about the use-livecode mailing list