doumanni3501 2017-05-19 15:45
浏览 10
已采纳

php:如何检查用户是否从下载服务器登录?

I have two server, First one main server (database stored here) and second one is download server (files stored in it), I want limit download links only for registered users in download server. In download server how can I check if users logged in or not? and if logged in is account expired or not? I'm using php. thanks...

  • 写回答

1条回答 默认 最新

  • douye1876 2017-05-19 16:42
    关注

    Here's how I solved this:

    All links to the download server would point to the main server instead. The main server would check for login, then generate a key for the user storing that key in the user's db table. Then redirect the user to the download server including the generated key string and user id in the redirect link to the download server. The download server would make a call to an API on the main server. The API would run a query against the id & key string and return a success|fail response. Upon success the download server would deliver the resource and the main server would NULL the key field in the user's table.

    You would need 3 files: 1) main server/link.php - checks log in, updates key, redirects to download server. 2) download server/resource.php - calls API to check access, delivers content. 2) main server/api.php - confirms access, NULLs out used key.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 阿里云python代码求解
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥15 统计大规模图中的完全子图问题
  • ¥15 使用LM2596制作降压电路,一个能运行,一个不能
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路