php用户注册对密码进行MD5加密
来源:互联网 发布:app inventor小软件 编辑:程序博客网 时间:2024/06/03 08:41
一 代码
conn.php
<?php$conn = mysql_connect("localhost","root","root") or die("数据库错误".mysql_error());mysql_select_db("db_database21",$conn) or die("数据库错误".mysql_error());mysql_query("set names gb2312");?>
index.php
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>使用md5对用户注册密码进行加密</title><style type="text/css"><!--body,td,th {font-size: 12px;}body {margin-left: 10px;margin-top: 10px;margin-right: 10px;margin-bottom: 10px;}.STYLE1 {font-size: 14px;font-weight: bold;}--></style></head><body><table width="777" height="587" border="0" align="center" cellpadding="0" cellspacing="0" background="images/bg.jpg"> <tr> <td width="149" height="200"> </td> <td width="448"> </td> <td width="158"> </td> </tr> <tr> <td height="187"> </td> <td align="center" valign="middle"> <form id="form1" name="form1" method="post" action="index_ok.php"> <table height="160" border="0" cellpadding="0" cellspacing="0"> <tr><td width="83" height="30" align="right" valign="middle" scope="col"><span class="STYLE1">用户名:</span></td> <td width="267" height="30" align="left" valign="middle" scope="col"><label for="textfield"></label> <input name="username" type="text" id="username" size="24" /></td> <td width="25" align="center" valign="middle" scope="col"> </td> </tr> <tr> <td height="30" align="right" valign="middle" class="STYLE1" scope="col">密码:</td> <td height="30" align="left" valign="middle" scope="col"><input name="password" type="password" id="password" size="25" /></td> <td align="center" valign="middle" scope="col"> </td> </tr> <tr> <td height="30" align="right" valign="middle" class="STYLE1" scope="col">地址:</td> <td height="30" align="left" valign="middle" scope="col"><input name="address" type="text" id="address" size="35" /></td> <td align="center" valign="middle" scope="col"> </td> </tr> <tr> <td height="30" align="right" valign="middle" class="STYLE1" scope="col">电话:</td> <td height="30" align="left" valign="middle" scope="col"><input name="tel" type="text" id="tel" size="20" /></td> <td align="center" valign="middle" scope="col"> </td> </tr> <tr> <td height="40" colspan="3" align="center" valign="middle" scope="col"><input type="image" name="imageField" src="images/bg2.JPG" /> <input type="image" name="imageField2" src="images/bg1.JPG" onclick="form.reset();return false;" /></td> </tr> </table> </form> </td> <td> </td> </tr> <tr> <td height="200"> </td> <td> </td> <td> </td> </tr></table></body></html>
index_ok.php
<?php include("conn/conn.php");if(trim($_POST[username])!= "" and trim($_POST[password])!= "" and trim($_POST[tel])!=""){$pwd = md5($_POST[password]);$sql = "insert into tb_user(username,password,address,explains)values('".$_POST[username]."','".$pwd."','".$_POST[address]."','".$_POST[tel]."')";$result = mysql_query($sql,$conn);if($result){echo "<font color='red'>注册成功。</font>";}else{echo "<font color='green'>注册失败!</font>";}}else{echo "请认真填写用户名和密码!";}?>
二 运行结果
注册成功。
数据库数据如下:
阅读全文
0 0
- php用户注册对密码进行MD5加密
- 对用户输入的密码进行MD5加密
- MD5加密!对密码进行MD5加密和验证
- C#:使用MD5对密码进行加密!
- .net对密码进行MD5加密
- 对密码字段进行加密(MD5)
- 使用MD5对密码进行加密
- 使用MD5对密码进行加密
- 用java对密码进行MD5加密
- 用java对密码进行MD5加密
- MD5对密码进行加密处理机制
- 使用MD5对明文密码进行加密
- 使用Md5算法对密码进行加密
- 密码进行MD5加密
- 对用户的密码进行加密
- 用户登录对密码进行加密
- 关于注册密码md5加密
- 使用md5算法对密码进行加密保存
- 利用python实现网络爬虫
- js 如何阻止a标签刷新当前页面
- chrome源代码下载
- oracle和hibernate的正向工程和反向工程(详细图解)
- Sublime Text Html插件
- php用户注册对密码进行MD5加密
- 条件,循环和其他语句
- php实现用户注册密码的crypt加密
- JAVA学习(1)
- golang使用二叉树实现排序
- 实现一个 Swiper
- 字体问题记录
- SylixOS网络数据异步处理原理
- eclipse中使用自带git的常用操作