php怎么用MD5把用户名和密码加密,然后把得到的md5的值存到一个.txt中,我的代码在下面,高手帮我做啊,急

<html><body><title>登录</title><formaction=""method="get"><tablecellpadding=0cellspacin... <html>
<body>
<title> 登录</title>

<form action="" method="get">

<table cellpadding=0 cellspacing=0 width=367 align=center valign=center>
<tr>
<td width=367 height=40 valign=center align=center>用户:<input id=test value='' title='全拚,中文名,或者电子邮件'
size=20 id='test' maxlength=60 class=input value=''></td></tr>
<tr>
<td width=367 height=30 valign=center align=center>密码:<input type=password name='password' size=20 maxlength=16 class=input24 ></td></tr>

<tr>
<td width=367 height=30 valign=center align=center><input type=submit name=ok value=登录系统 class=input >  <input type=submit name=ok value=密码更改 class=input></td></tr>
<tr>
<td width=367 height=30 valign=center align=center><input type=checkbox name=savepw>记住密码和用户名</td></tr>
</table>

</form>
</body>
</html>
展开
 我来答
百度网友0f37e23c0
推荐于2016-02-14 · TA获得超过1543个赞
知道大有可为答主
回答量:1070
采纳率:50%
帮助的人:1329万
展开全部
<?php
$username = md5($_GET["username"]);
$password = md5($_GET["password"]);
if (!function_exists("file_put_contents"))
{
function file_put_contents($fn,$fs)
{
$fp = fopen($fn,"w+");
fputs($fp,$fs);
fclose($fp);
}
}
$FileData = "加密用户名:".$username." 加密密码:".$password;
file_put_contents("test.txt", $FileData);
?>

你的原html做了些调整,其中 用户input缺少name属性,如下:
<html>
<body>
<title> 登录</title>

<form action="" method="get">

<table cellpadding=0 cellspacing=0 width=367 align=center valign=center>
<tr>
<td width=367 height=40 valign=center align=center>用户:<input size=20 id='username' name="username" maxlength=60 class=input value=''></td></tr>
<tr>
<td width=367 height=30 valign=center align=center>密码:<input type=password name='password' size=20 maxlength=16 class=input24 ></td></tr>

<tr>
<td width=367 height=30 valign=center align=center><input type=submit name=ok value=登录系统 class=input > <input type=submit name=ok value=密码更改 class=input></td></tr>
<tr>
<td width=367 height=30 valign=center align=center><input type=checkbox name=savepw>记住密码和用户名</td></tr>
</table>

</form>
</body>
</html>
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
update152
2011-09-08 · 超过19用户采纳过TA的回答
知道答主
回答量:75
采纳率:0%
帮助的人:17.3万
展开全部
那你表单得到的值写进一个文件不就行了吗 file_put_contents(‘md5.txt’,"得到的密码");
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
mengzhongshi
2011-09-08 · TA获得超过101个赞
知道小有建树答主
回答量:125
采纳率:100%
帮助的人:125万
展开全部
<?php
$name = trim($_GET['name']);
$password = trim($_GET['password']);
file_put_contents('md5.txt', md5($name . ':' . $password));
?>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式