怎样隐藏用户名和密码。

gushuheng 2004-11-30 04:46:30
我用的 submit 提交 用户名和 密码 , 发现在 url中会出现,应该怎样从url中去掉,而servlet又能得到! 谢!
...全文
528 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
gushuheng 2004-12-03
  • 打赏
  • 举报
回复
没想到居然post 旧能搞顶
zhz586 2004-12-01
  • 打赏
  • 举报
回复
如果只是用户的登陆
action用post!
redpark 2004-12-01
  • 打赏
  • 举报
回复
怎么可能用get 呢
起码post要好哦
支持用加密的方法
jFresH_MaN 2004-12-01
  • 打赏
  • 举报
回复
把FORM的action属性改成post在URL中就看不到发送的信息了。

如果安全性要求更高就自己加个密吧
drugon 2004-12-01
  • 打赏
  • 举报
回复
把FORM的action属性改成post在URL中就看不到发送的信息了。
lijunjiejava 2004-12-01
  • 打赏
  • 举报
回复
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin

function encrypt(str, pwd) {
if(pwd == null || pwd.length <= 0) {
alert("Please enter a password with which to encrypt the message.");
return null;
}
var prand = "";
for(var i=0; i<pwd.length; i++) {
prand += pwd.charCodeAt(i).toString();
}
var sPos = Math.floor(prand.length / 5);
var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos*2) + prand.charAt(sPos*3) + prand.charAt(sPos*4) + prand.charAt(sPos*5));
var incr = Math.ceil(pwd.length / 2);
var modu = Math.pow(2, 31) - 1;
if(mult < 2) {
alert("Algorithm cannot find a suitable hash. Please choose a different password. \nPossible considerations are to choose a more complex or longer password.");
return null;
}
var salt = Math.round(Math.random() * 1000000000) % 100000000;
prand += salt;
while(prand.length > 10) {
prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString();
}
prand = (mult * prand + incr) % modu;
var enc_chr = "";
var enc_str = "";
for(var i=0; i<str.length; i++) {
enc_chr = parseInt(str.charCodeAt(i) ^ Math.floor((prand / modu) * 255));
if(enc_chr < 16) {
enc_str += "0" + enc_chr.toString(16);
} else enc_str += enc_chr.toString(16);
prand = (mult * prand + incr) % modu;
}
salt = salt.toString(16);
while(salt.length < 8)salt = "0" + salt;
enc_str += salt;
return enc_str;
}

function decrypt(str, pwd) {
if(str == null || str.length < 8) {
alert("A salt value could not be extracted from the encrypted message because it's length is too short. The message cannot be decrypted.");
return;
}
if(pwd == null || pwd.length <= 0) {
alert("Please enter a password with which to decrypt the message.");
return;
}
var prand = "";
for(var i=0; i<pwd.length; i++) {
prand += pwd.charCodeAt(i).toString();
}
var sPos = Math.floor(prand.length / 5);
var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos*2) + prand.charAt(sPos*3) + prand.charAt(sPos*4) + prand.charAt(sPos*5));
var incr = Math.round(pwd.length / 2);
var modu = Math.pow(2, 31) - 1;
var salt = parseInt(str.substring(str.length - 8, str.length), 16);
str = str.substring(0, str.length - 8);
prand += salt;
while(prand.length > 10) {
prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString();
}
prand = (mult * prand + incr) % modu;
var enc_chr = "";
var enc_str = "";
for(var i=0; i<str.length; i+=2) {
enc_chr = parseInt(parseInt(str.substring(i, i+2), 16) ^ Math.floor((prand / modu) * 255));
enc_str += String.fromCharCode(enc_chr);
prand = (mult * prand + incr) % modu;
}
return enc_str;
}
// End -->
</script>
<form name="box"><center>
<table cellpadding=0 cellspacing=0 border=0><tr><td colspan=3>
<textarea cols=40 rows=5 wrap=virtual name=ipt>Welcome to wanruo.jahee.com</textarea>
</td></tr>
<tr height=50><td valign="top">
<input type="button" onclick="document.box.opt.value= encrypt(document.box.ipt.value, document.box.pwd.value);" value="加密">
</td><td align="center" valign="center">
<input type="text" name="pwd" value="password">
</td><td align="right" valign="bottom">
<input type="button" onclick="document.box.ipt.value= decrypt(document.box.opt.value, document.box.pwd.value);" value="解密">
</td></tr>
<tr><td colspan=3>
<textarea cols=40 rows=5 wrap=virtual name=opt></textarea>
</td></tr></table>
</center>
</form>

这是个用javascript加密文字的简单例子。
你用java把加密和解密的方法重写一下用到你的程序中就可以了
speedingman 2004-12-01
  • 打赏
  • 举报
回复
用post就可以了!
lijunjiejava 2004-12-01
  • 打赏
  • 举报
回复
用post或者。
在你传值得时候先用个方法把要传得数据加密。在得到后对他进行解密然后去判断
liubeiqi 2004-12-01
  • 打赏
  • 举报
回复
用下string meb=response.encodeURL("")
sendRedirect(meb)
试试。新手!不对的地方包含下
JamesLeeCH 2004-12-01
  • 打赏
  • 举报
回复
同上
shenyouth 2004-12-01
  • 打赏
  • 举报
回复
1。可以放在form里提交
2。用method = post就行了
panzhiwei 2004-12-01
  • 打赏
  • 举报
回复
你把METHOD的方法用POST就可以了,用GET的话,在URL中可以看到,也就是说用GET是不加密的!用POST可以加密!
squares 2004-12-01
  • 打赏
  • 举报
回复
晕倒,仔form标签里面放method=pose啊
founderf 2004-11-30
  • 打赏
  • 举报
回复
1。可以放在form里提交
2。用method = post就行了
gushuheng 2004-11-30
  • 打赏
  • 举报
回复
我用的是get方法,不需要加密!
bestvanguard 2004-11-30
  • 打赏
  • 举报
回复
你用的是post方法吧
zhaolin81 2004-11-30
  • 打赏
  • 举报
回复
如果需要加密,用https咯

50,527

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧