【问题标题】:How to restrict a client to install a web application for only one domain如何限制客户端仅为一个域安装 Web 应用程序
【发布时间】:2014-02-22 12:51:39
【问题描述】:

我有一个产品(Web 应用程序),5-10 个客户要求在他们自己的域中安装相同的应用程序。我安装没有任何问题,但是一些客户(具有技术知识)正在安装 2、3 个域而无需为我付费。我怎样才能将它们限制在一个域中。我的意思是我们必须遵循的一些身份验证过程,它可以访问客户端进行安装。

谁能给我任何建议。

谢谢。

【问题讨论】:

  • 您可以为每个 Web 应用程序指定一个唯一的 ID。然后使用require() 从您的站点获取一个页面,该页面检查数据库中的唯一ID,如果它已经在数据库中,则停止工作?

标签: php security authentication oauth-2.0 restrict


【解决方案1】:

创建一个向你的服务器发送请求的函数,例如:

 function checkSerial($serial = '1111-1111-1111-1111') {
       $server = file_get_contents('http://server.your-domain.com');
       if (json_decode($server)) { 
             $result = json_decode($server);
             if ($result[0] == 'valid') return true; else return false
       } else return false;
 }

还有服务器端的东西(index.php):

 if (isset($_GET['serial'])) { 
       if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1' && !empty($_GET['serial']) && $_GET['serial'] == '1111-1111-1111-1111-')) {
       $result = array('valid');
       } else $result = array('invalid');
 } else $result = array('invalid');
 echo json_encode($result);

这只是一个快速演示如何实现这样的事情!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-23
    • 1970-01-01
    • 2015-06-02
    • 2016-02-25
    相关资源
    最近更新 更多