zoukankan      html  css  js  c++  java
  • 10.23日进度报告

    今天做了修改密码的功能

    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8" import="java.sql.*"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>修改密码</title>
    </head>
    <body>
    <jsp:useBean id="db" class="DBBean.Bean" scope="page" />
        <%!String a, b;%>
        <%-- 将ab设为全局变量。 --%>
        <% 
            request.setCharacterEncoding("utf-8");
            String Iname = (String) session.getAttribute("Iname");
            System.out.println(" ");
            System.out.println("resetpass.jsp 界面信息:");
            System.out.println("resetpass界面的Iname:" + Iname);
            String str = "select Iadd,Ifrdb,Iemail,Iyzbm,Iweb,Iclient,Igh,Iphone,Ifax from baseInfo where Iname=" + "'"
                    + Iname + "'";
            ResultSet rs2 = db.executeQuery(str);
            
            %>
            <form action="updatepass.jsp" method="post">
            <p>当前登录的用户为: <%=Iname%></p>
            <p>请输入修改后的密码: <input type="password" name="repass1"></p>
            <p>请确认修改后的密码: <input type="password" name="repass2"></p>
            <input type="submit" value="确认修改">
            </form>
        
    </body>
    <%
            rs2.close();
            db.close();
        %>
    </html>
    View Code
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8" import="java.sql.*"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <jsp:useBean id="db" class="DBBean.Bean" scope="page" />
    <%
     
            request.setCharacterEncoding("utf-8");
            String Iname = (String) session.getAttribute("Iname");
            System.out.println(" ");
            System.out.println("updatepass.jsp 界面信息:");
            System.out.println("updatepass界面的Iname:" + Iname);
            String repassword1 = request.getParameter("repass1");
            String repassword2 = request.getParameter("repass2");
     //判断密码
            System.out.print(repassword1);
            System.out.print(repassword2);
            
            if(repassword1.equals(repassword2))
            {
                Class.forName("com.mysql.jdbc.Driver");
            
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8", "root", "123456");
            Statement stmt = con.createStatement();
            
            String sql = "update baseInfo set Ipassword='" + repassword1 + "' where Iname=" + "'"
            + Iname + "'";
    
            int i = stmt.executeUpdate(sql);
    
            if (i == 1) {
                out.println("<h2>修改成功!</h2><br/>");
                
                
            } else {
                out.println("<h2>修改不符合条件,失败!</h2><br/>");
                
            }
            stmt.close();
            con.close();
            }
            else {
                out.println("<h2>修改不符合条件,失败!</h2><br/>");}
    %>
    </body>
    
    </html>
    View Code
  • 相关阅读:
    (转)linux下控制帐户过期的多种方法
    跟老男孩学Linx运维---web集群实战笔记
    (转)企业生产环境用户权限集中管理方案案例
    Linux 运维培训笔记
    (转)sudo配置文件/etc/sudoers详解及实战用法
    (转) RHEL7 忘记密码修改root密码
    (转)Mysql数据库之Binlog日志使用总结CentOS 7.x设置自定义开机启动,添加自定义系统服务
    git 删除远程分支
    crontab详解
    PHP数据库长连接mysql_pconnect用法
  • 原文地址:https://www.cnblogs.com/zhjvvvvvv/p/14206287.html
Copyright © 2011-2022 走看看