谁能帮我写用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 阅读 599 次 更新于 2025-09-10 16:24:30 我来答关注问题0
  • bruceleexun 求高人给一个用PHP+MySQL实现的简单的数据库查询功能的PHP和HTML代码

    public $conn;public function Database() { this->conn = mysql_connect("localhost","user","password");mysql_select_db("gamesearch",$this->conn);mysql_query("SET NAMES 'UTF8'");} public function get_data_array($sql) { rs = mysql_query($sql,$this->conn);data_array = a...

  • 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...

  •  阿暄生活 php如何连接mysql数据库-php连接mysql数据库的方法

    PHP连接MySQL数据库的方法主要如下:1. 创建PHP文件:首先需要创建一个新的PHP格式文件,这个文件将用于编写连接数据库的代码。2. 使用XAMPP等工具:XAMPP是一个常用的PHP开发环境,它包含了Apache服务器、MySQL数据库等组件。确保XAMPP已经安装并运行,这样PHP代码才能访问MySQL数据库。3. 编写PHP代码:在...

  • class Mysql{ //首先定义一个类,首写字母大写 public $host;//服务器名,访问修饰符PUBLIC证明$host是一个公共的属情在类的内部外部都可访问,可以被继承 public $user;//用户名,是公共的属性 private $pass;//密码,问修饰符private证明$pass是私有的.只能在类的内部使用且不能被继承.public $...

  •  jiangxibaiyi 用php写网页对mysql进行删除,查询

    我刚刚写了一堆代码,正好是你想要的,什么都写完整了,有写入记录,修改记录,删除记录,还有分页显示,不过没写注释 希望对你有帮助 ?> PHP结合MYSQL数...

檬味博客在线解答立即免费咨询

代码相关话题

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