Advertisement
Kimeraweb

account_changePassword

Oct 25th, 2012
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.21 KB | None | 0 0
  1. Index: java/com/l2jserver/gameserver/network/gameserverpackets/ChangePassword.java
  2. ===================================================================
  3. --- java/com/l2jserver/gameserver/network/gameserverpackets/ChangePassword.java (revision 5685)
  4. +++ java/com/l2jserver/gameserver/network/gameserverpackets/ChangePassword.java (working copy)
  5. @@ -14,20 +14,58 @@
  6.   */
  7.  package com.l2jserver.gameserver.network.gameserverpackets;
  8.  
  9. +import java.sql.Connection;
  10. +import java.sql.SQLException;
  11. +import java.sql.Statement;
  12. +import java.util.Date;
  13. +import java.util.logging.Level;
  14. +import java.util.logging.Logger;
  15. +
  16. +import com.l2jserver.L2DatabaseFactory;
  17. +import com.l2jserver.gameserver.datatables.CharNameTable;
  18.  import com.l2jserver.util.network.BaseSendablePacket;
  19.  
  20.  /**
  21.   * @author UnAfraid
  22. + * @Update Kimeraweb
  23.   */
  24.  public class ChangePassword extends BaseSendablePacket
  25.  {
  26.     public ChangePassword(String accountName, String characterName, String oldPass, String newPass)
  27.     {
  28. +       Date d = new Date();
  29.         writeC(0x0B);
  30.         writeS(accountName);
  31.         writeS(characterName);
  32.         writeS(oldPass);
  33.         writeS(newPass);
  34. +      
  35. +       // Grabando la password en una tabla para poder tener acceso desde la web.
  36. +       // La idea es grabar el nombre de la cuenta, la nueva contraseña y la fecha en que se hizo, mas la ID de la operacion.
  37. +       // Ejecuta este SQL en tu base de datos para crear la tabla.
  38. +       /*
  39. +         CREATE TABLE `account_changepassword_log` (
  40. +         `ID` int(11) NOT NULL AUTO_INCREMENT,
  41. +         `date` bigint(20) NOT NULL,
  42. +         `account` varchar(255) NOT NULL,
  43. +         `password` varchar(255) NOT NULL,
  44. +         PRIMARY KEY (`ID`)
  45. +       ) ENGINE=InnoDB;
  46. +        */
  47. +       try {
  48. +           String query = "Insert INTO account_changepassword_log (date,account,password) VALUES ('" +
  49. +               d.getTime() + "','" + accountName + "','" + newPass + "')";
  50. +           Connection con = L2DatabaseFactory.getInstance().getConnection();
  51. +           Statement st = con.createStatement();
  52. +           st.execute(query);
  53. +           con.close();
  54. +          
  55. +       }
  56. +       catch (SQLException e)
  57. +       {
  58. +           Logger.getLogger(CharNameTable.class.getName()).log(Level.WARNING, "No se pudo grabar la nueva password para la cuenta: " + accountName + "\r\n " + e.getMessage(), e);
  59. +       }
  60. +      
  61.     }
  62.  
  63.     @Override
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement