duanqi6007 2014-07-10 12:20
浏览 51

用php动态ip跟踪

I have a problem and I hope someone can help.

So I have a web page (www.mydomain.com)
And I have 3 partner. They are restaurants with wifi access.
If a guest connect to my web page through the wifi, I would show some offer.
It's easy, but I would like to show different offer to every restaurants.

I could use different domains, in every restaurants like:
www.mydomain.com/restaurant1
www.mydomain.com/restaurant2
www.mydomain.com/restaurant3

But I think more elegant the basic domain (www.mydomain.com) and some php code.

I tried to use $_SERVER['REMOTE_ADDR'] to know clinet IP.
If I recognize the IP .I can show the right offer.
It is very helpful but my partners ip is not fix. They have dynamic ip.

My question is, how can I tracking my partners dynamic IP ?
Or What solutions exist to recognize who connected to my web page?

Thanks

  • 写回答

1条回答 默认 最新

  • douke1942 2014-07-10 14:59
    关注

    I don't think you can do this strictly based on the IP and partially for the reasons you suggest. Namely that very few people have fixed IP addresses. Another factor is that, very soon (if you're not already), you're going to have to support IPv6 as well. Some ISPs will start using a public IPv6 and set the local address to a non-routing IP. That means that they might appear under the same IP. AOL used to do this many years ago and has now come full circle due to the IPv4 address shortage.

    But I digress. It isn't a good idea either way. Even if you somehow got the IP thing working, it isn't easily scaled (what if you get 100 clients? 1000? How would you manage this?)

    What you need to do is is give them some way to identify themselves. Maybe set up a login or a unique URL for them.

    评论

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)