This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Detect client
#1
Hi,

Is there a way to determine the client,  ie an hostname or mac address?  For example you have an iPad in each room, based on the hostname you could then display a specific page that contain lighting controls of that room.

Thanks,

Roger
Reply
#2
You can create for every room different login and password and give it access only to for specified room page.
Reply
#3
Hi Roger,

Client information can only be received by a serverside call and is not available directly from browser information.

This means you need a file on your system that you open and this can give you the client information.

I use a .lp file for this, so if you want to do this it means you need to do it by some self created startpage app or change the content of the index.html and redirect from there to your .lp file and this .lp file can determine based on IP what page should be shown.

I think i'ts easier to give every user a seperate acount and give acces to only there page.

I requested a option to give each user a selectable startpage, but it's not there yet, so lets hope my request will be build in some day (:

Sample of a .lp file that can do what you want:

Code:
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?
            require('apps')
            clienthost = ngx.var.http_host
            clientip = ngx.var.remote_addr
            clientuser = request.username or 'anonymous'
        ?>
        <script type="text/javascript">
            var Client_Host = <? json.write(clienthost) ?>;
            var Client_IP = <? json.write(clientip) ?>;
            var Client_User = <? json.write(clientuser) ?>;
            console.log(Client_Host);
            console.log(Client_IP);
            console.log(Client_User);
        </script>
    </body>
</html>
BR,

Erwin
Reply
#4
Thank you
Reply


Forum Jump: