初学者又来

WBOY
Release: 2016-06-13 12:48:01
Original
787 people have browsed it

菜鸟又来请求帮助
以下代码要完成读取当前用户名和密码,假如选择保存信息,则把资料保存下来,以后可以自动登录,
我才初学,看不懂那里错了,请各位大侠帮忙看看,多谢!

  session_start();
?>


 include ('connect.php');
保存登录信息



<script> <br /> function fun_new()<br /> {<br /> if (ThisForm.Keepinfo.value=='Keepinfo')<br /> {<br /> ThisForm.action='loginchg.php';<br /> ThisForm.submit();<br /> }<br /> }<br /> //启动会话<br /> //获取用户输入,由于用户已经进入系统,所以只要获取当前的用户何密码即可<br /> $Username1 =$HTTP_POST_VARS["user"];//user为用户输入的用户名<br /> $Password1 = $HTTP_POST_VARS["pass"];//pass为用户输入的密码<br /> $Remember= $HTTP_POST_VARS['Keepinfo'];<br /> //如果用户点保存登录信息,将remember置为1,否则为0;<br /> if($Remember=="Keepinfo")<br /> {<br /> $Remember="1";<br /> }<br /> else<br /> {<br /> $Remember="0";<br /> }<br /> <br /> //创建会话,保存登录信息<br /> session_register("Password");//保存密码<br /> $HTTP_SESSION_VAR["Password"]=$Password1;<br /> session_register("Username");<br /> $HTTP_SESSION_VAR["Username"]=$Username1;<br /> //发送cookie 到客户端,密码被加密<br /> if ($Remember=="1")<br /> {<br /> setcookie("RememberCookieUsername", $Username1, time()+365*24*60*60);<br /> setcookie("RememberCookiePassword", md5($Password1), time()+365*24*60*60);<br /> exit;<br /> }<br /> ?><br /> <br /> <br /> </script>
~

------解决方案--------------------
这么古老的代码,运行时不报错吗?
------解决方案--------------------
能说说错在哪里了么,,
setcookie这个function好像这里没有用啊

------解决方案--------------------
引用:
能说说错在哪里了么,,
setcookie这个function好像这里没有用啊


不好意思之前看的不仔细,,我以为那个是javascript
设置cookie我只用过$_COOKIE。。。
楼主还是描述一下什么地方有问题吧,,这样就算别人测试起来也方便
------解决方案--------------------
HTTP_POST_VARS  没接错过这个啊  现在还有用吗?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template