数据库服务
<?php
header("content-type:text/html;charset=utf-8"); //编码
include("conn/conn.php"); //链接数据库
if(isset($_POST['xiugai'])){ //判断有没有修改按钮
$user=$_POST['user']; //定义用户名变量
$pwd=$_POST['pwd']; //原密码变量
$xpwd=$_POST['xpwd']; //新密码变量
$section=$_POST['section']; //部门名称变量
$name=$_POST['name']; //真实姓名变量
$insert=mysql_query("update tb_login set pwd='$xpwd',section='$section',name='$name' where user='$user' and pwd='$pwd'",$conn); //更新数据库语句
echo mysql_error();
if($insert){//判断是否执行
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
echo "<script>alert('修改成功');window.location.href='index.php'</script>"; //修改成功
}
else{
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
echo "<script>alert('修改失败');window.location.href='guanli.php'</script>"; //修改失败
}
}
?>这个是网页代码
<form action="guanli_ok.php" method="post" enctype="multipart/form-data" name="form2" id="form2">
<table width="527" height="282" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="194" height="46"><div align="left"><?php echo $_SESSION['user'];?> 用户信息修改</div></td>
<td width="333"><div align="left"></div></td>
</tr>
<tr>
<td height="46"><div align="right">用户名:</div></td>
<td><div align="left"><input type="text" name="user" readonly="readonly" value="<?php echo $_SESSION['user'];?>"/></div></td>
</tr>
<tr>
<td height="40"><div align="right">原密码:</div></td>
<td><div align="left"><input type="text" name="pwd" /></div></td>
</tr>
<tr>
<td height="30"><div align="right">新密码:</div></td>
<td><div align="left"><input type="text" name="xpwd" /></div></td>
</tr>
<tr>
<td height="30"><div align="right">确认密码:</div></td>
<td><div align="left"><input type="text" name"quren" /></div></td>
</tr>
<tr>
<td height="30"><div align="right">部门:</div></td>
<td><div align="left"><input type="text" name="section" /></div></td>
</tr>
<tr>
<td height="30"><div align="right">真实姓名:</div></td>
<td><div align="left"><input type="text" name="name" /></div></td>
</tr>
<tr>
<td height="30"> </td>
<td><input type="submit" name="xiugai" value="确认修改"/> </td>
</tr>
</table>
</form>问题是最后就算我原密码是输入错误的提示也是修改成功跳转到了index.php页面 但是数据库没修改 原密码正确就一切正常
...全文
相关推荐
db-component:使用 Web 服务连接到任何数据库的组件
【db-component】是一个Java开发的组件,其主要功能是通过Web服务的方式,使得应用程序能够方便地连接并操作各种类型的数据库。
ocdp-database:OCDP数据库的Nodejs服务器
本篇文章将深入探讨如何利用Node.js搭建OCDP(可能代表某个特定的数据库或数据处理协议)数据库服务器,并结合JavaScript语言,创建一个强大的后端服务。### 1.
in-memory-db:用于NestJS项目的简单内存中数据库服务
**标题解析:**“in-memory-db”是一个专为NestJS项目设计的简单内存中数据库服务。
Todo_DB_Server:Todo数据库服务器
【Todo_DB_Server: Todo数据库服务器】是一个基于JSON的轻量级数据库服务器项目,它提供了一个简单的方式来管理和存储Todo任务。
基于嵌入式数据库Berkeley DB的嵌入式无线微型服务器
本文讨论的主题是基于嵌入式数据库Berkeley DB的嵌入式无线微型服务器。这一服务器平台的设计目标在于实现对只能设备的有效管理与控制,并能够通过无线方式接入互联网。


基础编程
