谁能帮我写用php和MySQL的一个后台登陆程序

/***这是cd.php里面的代码,请适当的修改***/
谁能帮我写用php和MySQL的一个后台登陆程序
在你的数据库里面新建一个表,取名为‘user’,就三个字段,id,username,password.
建立好了就把代码放上去吧。其实很简单,你的html要稍稍修改一下:

/****************************************************************************************************/

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>XXX后台登录系统</title>
<link href="css/login.css" rel="stylesheet" />
</head>
<body>
<div class="login_tit"><img src="images/登陆文字.png"/></div>

<form method="post" action="cd.php">
<div class="login_main">
<p>

<span>用户名</span> <input type="text" value="" class="input_01" name="username"/>
</p>
<p>
<span>密码</span> <input type="text" value="" class="input_01" name="password"/>
</p>
<p>
<input type="checkbox" value="" checked="checked" class="input_03"/><span id="rem">记住账号</span>

</p>
<p><span></span>
<input type="submit" value="提交" class="input_02" /></p>
</div>

<div class="login_user"></div>
</form>
</body>
</html>

/*******************************这是cd.php里面的代码,请适当的修改***********************************/

<?php
$username=$_POST['username'];
$paswd=$_POST['password'];
$conn=mysqli_connect('localhost','你的数据库用户名','你的数据库密码','你所使用的数据库');
$sql="select * from user where username='$username' and password='$paswd'";
$query=mysqli_query($conn,$sql);
$rel=mysqli_fetch_assoc($query);
if(!$rel){
echo '用户名或者密码不存在';
exit();
}else{
echo '登陆成功';
}

?>2014-08-02
可以使用框架吗?2014-08-01
你是自己写的吗?还是用哪些现有的程序2014-08-01
mengvlog 阅读 717 次 更新于 2025-10-31 08:48:38 我来答关注问题0
檬味博客在线解答立即免费咨询

代码相关话题

Copyright © 2023 WWW.MENGVLOG.COM - 檬味博客
返回顶部