⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 forgetpass.java

📁 JAVA邮件系统
💻 JAVA
字号:
/* 
 *  FolderServlet.java
 */

import java.io.*;
import java.util.Random;
import java.sql.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;

/**
 *
 * @author Liyan
 */

//The class hand the Http request
public class ForgetPass extends HttpServlet {

    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {

    response.setContentType("text/html;charset=GB2312");
		PrintWriter out = response.getWriter();
		HtmlOut htmlOut = new HtmlOut (response);

    String sMobile = request.getParameter("mobile");
		String sRealname = request.getParameter("name");

    String sPass=null;
    sPass=getUserPass(sRealname,sMobile);
 //		if((sPass!=null)&&(SMSSendMessage.sendUserInf(sMobile,sPass)==0)){
				//发送密码到用户手机
     String sMsg="您在" +CommonMethods.sICPName +"上的密码是:"+sPass+"--[声讯通公司]";
	 if((sPass!=null)&&SMSSendMessage.sendSMSByWAPStation (sMobile,sMsg))
	{
        response.sendRedirect ("/sms/getpassok.htm");
    }else{
			 response.sendRedirect ("/sms/getpassfail.htm");
	  }


   }

	//用户信息入库:
	public String getUserPass(String sRealName,String sNumber)
	{
		DBOperater DB = new DBOperater("smsuser");
    String sPass=null;
		String sSql="";
		sSql="select password from "+CommonMethods.sTableName +" where firstname='"+sRealName+"' and mobile='"+sNumber+"'";

    ResultSet rs = DB.executeQuery(sSql);
		try
    {
	    if(rs.next()){
	      sPass = rs.getString(1);
        System.out.println("sPass"+sPass);
      }
  	}catch(Exception ex){

	  }
		DB.close();
    return sPass;
	}

	//用户信息验证:

	//用户信息发送:
/*	public void sendUserInf(String sInf)
	{
		if(sInf==null)
			return;

		try
		{
			InetAddress ip = InetAddress.getByName("172.16.2.153");
			byte[] bInf= sInf.getBytes();
			DatagramPacket dPacket = new DatagramPacket(bInf,bInf.length,ip,8888);
			DatagramSocket dSocket = new DatagramSocket();
			dSocket.send(dPacket);
		}catch(Exception ex){
		}
  }*/
/*  	public int sendUserInf(String sMobile,String sPass)
	{
    CMPPClient_L_CONNECT cc;

    try {

      cc= new CMPPClient_L_CONNECT();

      if ((cc.open (CommonMethods.sICP ,CommonMethods.sPass ,CommonMethods.sServerIp ,CommonMethods.nPort  ,CommonMethods.bTLS ))==0)

      {

        int result=0;
        System.out.println(CommonMethods.nMsgID ++ +"is messageid");
        if (
          cc.setMsgInfo(CommonMethods.nMsgID ,CommonMethods.nRegistered_Delivery , CommonMethods.nMsgLevel
          ,CommonMethods.sServiceID ,CommonMethods.nTls_avaliable ,CommonMethods.nMsg_Fmt ,
          CommonMethods.sFeeType ,CommonMethods.sFeeCode ,CommonMethods.sValid_Time ,
          "",CommonMethods.sSrc_Terminal_ID ,sMobile,"您在"+CommonMethods.sICPName +"的密码是:"+sPass)==0
      )
      result = cc.submit ();
      cc.close ();
       return result;
      }
      else System.out.println("test cmpp");
	    } catch(Exception e) {
        System.out.println(e.toString());
    }
    return -1;

 }    */
  public void doPost(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {
        doGet(request, response);
        PrintWriter out = response.getWriter();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -