function setCookie(name,value) { var Days = 30; var exp = new Date(); //new Date("December 31, 9998"); exp.setTime(exp.getTime() + Days*24*60*60*1000); document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); } function getCookie(name) { var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); if(arr=document.cookie.match(reg)) return unescape(arr[2]); else return null; } function delCookie(name) { var exp = new Date(); exp.setTime(exp.getTime() - 1); var cval=getCookie(name); if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString(); }
你那个显示是因为你用get方式传的参数.
你可以用<INPUT TYPE="hidden" name='变量名'>来传参数就不会了.
也就是用post方式来传再有session不用这个传他也不会在session中出现
除非你用?代他.
因为你有这个设置enable-trans-sid
改掉就好,不过如果浏览器禁止了cookie,你的变量就没有办法传递了,我指sesssion的。
我觉得密码没有必要用cookie来保存
1:没有必要
2:危险
那在地址栏输入 http://127.0.0.1/luntan.php?user=xxxx不就能进啊
那还用注册做什么
那在地址栏输入 http://127.0.0.1/luntan.php?user=xxxx不就能进啊
那还用注册做什么
身份验证的方法有很多
1:数据库验证
2:http验证
3:判断用户登陆id是否是匿名登陆ida684dd572b1887661782981659331eed
等等-----我知道和常用的是以上三种,如果有其他的请高手补充而实现这些验证的方式有很多,传递变量的方式也很多不一定用session和cookie
首先,浏览器可能会禁止cookie
其次,cookie并不是很安全,而php中session默认的变量传递方式就是用cookie,当被禁止是会用session id传递----这要求enable-trans-sid所以,你说的情况只有在写代码的人故意的情况下出现浅妄薄见,望与斟酌
如果做两也一也为list.php一页为writ.php可是怎么用一个超级连接来传输变量呢?<input type=hidden name=user value=$user><input type=hidden name=password value=$password>可以从writ.php提交到list.php而list.php的$user和$password要想传输到writ.php总不能用<a href=writ.php?user=xxx&password=xxxxxxxx>留言</a>提交吧
帮忙解决一下 要多少分给多少分
我想了好几天了就是没明白超级连接怎么传递
{
var Days = 30;
var exp = new Date(); //new Date("December 31, 9998");
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name)
{
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg)) return unescape(arr[2]);
else return null;
}
function delCookie(name)
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}
使用http://127.0.0.1/luntan.php?user=xxxx时仅对未禁止使用
global方式访问post、get、cookie、session变量时,使用
global方式访问这些变量有效。
使用数组方式访问这些变量,可以限制数值来源。
使用cookie确实不很安全,但不直接影响实现session时使用cookie。
因为session为保存于服务器端变量,其使用的cookie其实是标记
该次Session的id号,其生存期仅为浏览器存在期。
使用setcookie将cookie变量赋空值,则可清除cookie变量.