wamp 登录界面制作连接数据库
2016-02-29 19:15
453 查看
技术:数据库技术,html,php,ASP网页编辑
源程序代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登陆界面</title>
</head>
<body>
<center>
<h1>请先登录</h1>
<br><br><br><br>
<form name="first" action="land2.php" method="post">
<table width="500" border="0" cellspacing="20" cellpadding="0">
<tr>
<td>用户名:</td>
<td><input type="text" name="ures"></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="ps"></td>
</tr>
<tr>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" value="登录"、><!--注册按钮-->
<input type="reset" value="取消"><!--取消按钮-->
</tr>
</table>
</form>
<br><br><br>
</center>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登陆</title>
</head>
<body><?php
if($_POST['ures']=='')
{
echo "<script>alert('用户名不能为空');</script>";
echo "<script language='javascript'>";
echo " location='index1.html ';";
echo "</script>";
}
elseif($_POST['ps']=='')
{
echo "<script>alert('密码不能为空');</script>";
echo "<script language='javascript'>";
echo " location='index1.html ';";
echo "</script>";
}
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
mysql_connect('localhost','root','');
mysql_select_db('mysql');
mysql_query('SET NAMES utf8');
$sql="SELECT password FROM aaa WHERE user='$_POST[ures]'";
$rs=mysql_query($sql);
$row=mysql_fetch_assoc($rs);
$r=$_POST['ures'];
if($row)
{
if($row['password']==md5($_POST['ps']))
{
echo "<script>alert('登陆成功');</script>";
}
else
{
echo "<script>alert('密码错误');</script>";
echo "<script language='javascript'>";
echo " location='index1.html ';";
echo "</script>";
}
}
else
{
echo "<script>alert('用户名不存在');</script>";
echo "<script language='javascript'>";
echo " location='index1.html ';";
echo "</script>";
}
?>
</body>
</html>
截图:
未完成原因:安装wamp是一直出错,换了好几版也出错,所以崩溃了,
目标是 拥有属于自己的一个网站,实现普通网站的功能
希望是多学点知识,
时间安排:周一一个 下午 和一些零碎时间
源程序代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登陆界面</title>
</head>
<body>
<center>
<h1>请先登录</h1>
<br><br><br><br>
<form name="first" action="land2.php" method="post">
<table width="500" border="0" cellspacing="20" cellpadding="0">
<tr>
<td>用户名:</td>
<td><input type="text" name="ures"></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="ps"></td>
</tr>
<tr>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" value="登录"、><!--注册按钮-->
<input type="reset" value="取消"><!--取消按钮-->
</tr>
</table>
</form>
<br><br><br>
</center>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登陆</title>
</head>
<body><?php
if($_POST['ures']=='')
{
echo "<script>alert('用户名不能为空');</script>";
echo "<script language='javascript'>";
echo " location='index1.html ';";
echo "</script>";
}
elseif($_POST['ps']=='')
{
echo "<script>alert('密码不能为空');</script>";
echo "<script language='javascript'>";
echo " location='index1.html ';";
echo "</script>";
}
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
mysql_connect('localhost','root','');
mysql_select_db('mysql');
mysql_query('SET NAMES utf8');
$sql="SELECT password FROM aaa WHERE user='$_POST[ures]'";
$rs=mysql_query($sql);
$row=mysql_fetch_assoc($rs);
$r=$_POST['ures'];
if($row)
{
if($row['password']==md5($_POST['ps']))
{
echo "<script>alert('登陆成功');</script>";
}
else
{
echo "<script>alert('密码错误');</script>";
echo "<script language='javascript'>";
echo " location='index1.html ';";
echo "</script>";
}
}
else
{
echo "<script>alert('用户名不存在');</script>";
echo "<script language='javascript'>";
echo " location='index1.html ';";
echo "</script>";
}
?>
</body>
</html>
截图:
未完成原因:安装wamp是一直出错,换了好几版也出错,所以崩溃了,
目标是 拥有属于自己的一个网站,实现普通网站的功能
希望是多学点知识,
时间安排:周一一个 下午 和一些零碎时间
相关文章推荐
- 数据库启动过程
- 数据库数据添加到TextView详解(limite参数如何使用)
- 通过JDBC 连接MySQL问题
- hiredis aeStop仅在redis命令的回调函数中生效 分析
- 文章标题
- Oracle GoldenGate Director安装和配置(无图)
- 批量SQL操作之批量获取
- oracle ,ibitis 存储过程的调用
- 并发环境下mysql插入检查方案
- Redis——学习之路二(初识redis服务器命令)
- Oracle什么时候需要Commit
- Oracle 11g R2 RAC 卸载 grid
- oracle11g R2 RAC卸载grid
- SQL GROUP BY 语句
- Oracle 10g配置单向stream流复制,完整记录
- 导入文件内容到数据库
- 多线程下不反复读取SQL Server 表的数据
- SQL基础教程
- oracle针对oracle和grid用户---环境变量设置---单实例和RAC
- 数据库安全模式 日志文件多工 控制文件多工 归档模式