简体   繁体   English

仅通过QR码访问移动网站?

[英]Access to a mobile website only from a QR code?

是否可以仅通过二维码限制对移动网站的访问?

It won't be absolute accuracy, but if you use a query string it should narrow down the results For example : index.php?refer=QR. 这不是绝对准确的,但是如果您使用查询字符串,则应该缩小结果范围,例如:index.php?refer = QR。 I would just like to state now that I am by no means experienced with PHP, so please don't hit me too hard if I get something wrong ;). 我现在想声明一下,我对PHP毫无经验,因此,如果我做错了,请不要打我;)。

Perhaps you could make it so the QR code redirects to a site and that site generates a key, even something as simple as the date and time. 也许您可以这样做,以使QR代码重定向到一个站点,并且该站点生成密钥,甚至是简单的日期和时间。 Therefore your query string could be: index.php?refer=QR&c=1215 因此,您的查询字符串可能是:index.php?refer = QR&c = 1215

If the code in the query string doesn't match that of the one currently in use then the person has been linked via direct entry, if it does match then a QR code was used. 如果查询字符串中的代码与当前使用的代码不匹配,则已通过直接输入链接了此人,如果匹配,则使用了QR码。

The redirecting solution given by @Sam should work well but if user manually types index.php?refer=QR&c=1215 or try to access page from history you may not be able to stop the user. @Sam提供的重定向解决方案应该可以正常工作,但是如果用户手动键入index.php?refer=QR&c=1215或尝试从历史记录访​​问页面,则可能无法停止用户。

My solution I, although its bit different, is make an and register it to process the your authority www.something.com . 我的解决方案我(尽管有所不同)是进行注册并处理您的权限www.something.com so the next time user scan a qr, android will read it and prompt user to open it in app and app can use WebView to open page without showing the actual url. 因此,下次用户扫描qr时,android将读取它并提示用户在app中打开它,而app可以使用WebView打开页面而不显示实际网址。

Android will redirect user to web browser if your app isn't installed, the way to handle would be to check if it contain's a app specific query parameter say source=app that will be added by app, if not, it will mean its opening from browser and here you can redirect user to install app from store. 如果未安装您的应用程序,Android会将用户重定向到Web浏览器,处理方法是检查该应用程序是否包含特定于应用程序的查询参数,例如source=app ,该参数将由应用程序添加,如果未添加,则表示它已打开从浏览器,在这里您可以重定向用户以从商店安装应用程序。

Hope this helps... 希望这可以帮助...

What you could do is point to a long URL that takes you to a page that sets or creates a cookie that must be set to visit the page. 您可以做的是指向一个较长的URL,该URL带您进入一个页面,该页面设置或创建了必须设置才能访问该页面的cookie。

However, if a user gets hold of the long link they could send it round. 但是,如果用户掌握了长链接,则可以将其发送出去。

What you could do is a php header to redirect and use htaccess to mask the URL so they don't get the URL. 您可以做的是重定向php标头,并使用htaccess屏蔽URL,以便他们不获取URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM