- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
所以我正在尝试实现 evercookie在 cakePHP 网站上,但我得到了一些非常非常奇怪的结果。我刚刚将代码文件复制并粘贴到我的 app/webroot 目录中,我似乎没有收到任何 404 错误,但我的 cookies 没有保存——它们正在被重写每一次。更奇怪的是,当我加载页面时,它向 Google.com 发送了至少 90 个 GET 请求,并在 Google Chrome 中存储了 4-5 个 SQLite 数据库; evercookie 网站只存储一个。
我生成的 HTML 页面中的代码是这样的:
var ec = new evercookie();
// set a cookie "id" to a random 10 character string
// usage: ec.set(key, value)
ec.set("id", "vm5m172dyg");
// retrieve a cookie called "id" (simply)
ec.get("id", function(value) { alert("Cookie value is " + value) });
// or use a more advanced callback function for getting our cookie
// the cookie value is the first param
// an object containing the different storage methods
// and returned cookie values is the second parameter
function getCookie(best_candidate, all_candidates)
{
alert("The retrieved cookie is: " + best_candidate + "\n" +
"You can see what each storage mechanism returned " +
"by looping through the all_candidates object.");
for (var item in all_candidates){
document.write("Storage mechanism " + item +
" returned: " + all_candidates[item] + "<br>");
}
}
ec.get("id", getCookie);
// we look for "candidates" based off the number of "cookies" that
// come back matching since it's possible for mismatching cookies.
// the best candidate is most likely the correct one
此代码的一部分写入我的文档,这是输出(对我来说看起来不错):
Storage mechanism userData returned: undefined
Storage mechanism cookieData returned: d9g6mfoo4y
Storage mechanism localData returned: d9g6mfoo4y
Storage mechanism globalData returned: undefined
Storage mechanism sessionData returned: d9g6mfoo4y
Storage mechanism windowData returned: d9g6mfoo4y
Storage mechanism historyData returned: undefined
Storage mechanism pngData returned: d9g6mfoo4y
Storage mechanism etagData returned: d9g6mfoo4y
Storage mechanism cacheData returned: d9g6mfoo4y
Storage mechanism dbData returned: d9g6mfoo4y
Storage mechanism lsoData returned: d9g6mfoo4y
Storage mechanism slData returned: d9g6mfoo4y
我的问题是如何阻止发送给 Google 的 90 多个请求?我不知道为什么要这样做。比方说,如果网站上同时有 10 个用户(这并不令人难以置信),那就超过了 900(0)。你们中有人知道为什么我每次刷新页面时 cookie 都会自行重置吗? 这正是我要避免的。
最佳答案
好吧,我不觉得自己很傻吗!事实证明,代码开头的 ec.set() 调用是在每次页面加载开始时设置 cookie。所以,我调整了一些东西,呃,它现在可以工作了。我不再向 Google 发送 90 个请求。
// retrieve a cookie called "id" (simply)
ec.get("id", function(value) {
if(value == undefined){
// set a cookie "id" to a random 10 character string
// usage: ec.set(key, value)
ec.set("id", "<?php echo $hash ?>");
}
else
{
// do nothing
}
});
关于php - 可怕的 Evercookie 和 CakePHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5425133/
我刚刚在 Github 上发现了 Evercookie 项目. Evercookie is a Javascript API that produces extremely persistent co
我正在开发的网络应用程序需要将设备识别为已激活或未激活,以防止它们使用尚未付费的服务。现在,我们将它存储在一个 webSQL 表中,如果您清除浏览器设置,您将完全被淹没,我们必须为您修复它。 是否有更
我发现很难获得 evercookie 设置的 cookie 的值。 我想做的只是检查是否设置了名称为 evercookie 的设置。如果未设置,则我想将其设置为某个数字。 类似下面的内容:var co
我一直在努力理解 Samy Kamkar 的 evercookie 代码,但他至少做了一件我根本无法理解的事情。相关代码可以在线查看http://code.google.com/p/beef/sour
我完全陷入尝试从检索函数中获取最佳的evercookie值并将其放入我可以使用的JS或PHP函数中。 下面的代码可以触发 best_candidate 的警报,但我不知道如何从函数中返回值(我猜嵌套函
所以我正在尝试实现 evercookie在 cakePHP 网站上,但我得到了一些非常非常奇怪的结果。我刚刚将代码文件复制并粘贴到我的 app/webroot 目录中,我似乎没有收到任何 404 错误
我正在寻找一种解决方案来检测在我的网站上创建许多帐户的作弊者。 我发现了永久性跨浏览器 cookie:http://samy.pl/evercookie/ 但它是用 JS 编写的,我需要在 rails
我点击了链接 https://github.com/truongsinh/node-evercookie 首先在config/http.js中创建一个用于连接的中间件 然后点击链接: http://s
我正在研究一种在多个帐户上自动上传\管理 amazon kindle 平台上的内容的方法。 一位对亚马逊有丰富经验的人告诉我,亚马逊臭名昭著地使用某种 permanent cookie (我猜这是几起
我想用ever cookie创建永久cookie,但是当我在本地主机(Php wamp服务器)上运行ever cookie程序时,它不会创建任何cookie并显示以下错误 Not Found The
我是一名优秀的程序员,十分优秀!