【发布时间】:2011-08-27 11:10:38
【问题描述】:
我正在使用 nodejs 和 nowjs。我想获取在服务器上调用该函数的函数的主体长度并检查它是否相同。防止用户操纵客户端功能。并且可能排除可能发生变化的变量。有没有办法在 javascript 中做到这一点?
例如
客户
now.sendMessage() {
//Some code...
}
服务器
everyone.now.sendMessage() {
//Check that the code is the exact length
//as the function body written in the clientside script
//To see if it has been manipulated...
if (codelength === ?) {
//execute code
} else {
//return error
}
}
【问题讨论】:
-
没有。你试图达到的目标是不可能的。
-
想一想,整个事情的核心仍然是使用 HTTP。用不同的语言编写脚本并在服务器上发送“一些数字”非常容易。
标签: javascript node.js nowjs-sockets