Jump to content

[share]SQLAcountManager fix + email support


Recommended Posts

everyone has thought about it ... and i did it while waiting for complie

http://mysticdragon.ulmb.com/acm.patch.txt

 

Index: java/net/sf/l2j/accountmanager/SQLAccountManager.java
===================================================================
--- java/net/sf/l2j/accountmanager/SQLAccountManager.java	(revision 1247)
+++ java/net/sf/l2j/accountmanager/SQLAccountManager.java	(working copy)
@@ -40,6 +40,7 @@
{
     private static String _uname = "";
     private static String _pass = "";
+    private static String _email = "";
     private static String _level = "";
     private static String _mode = "";
     
@@ -47,6 +48,9 @@
     {
         Server.serverMode = Server.MODE_LOGINSERVER;
         Config.load();
+		System.out.println("");
+        System.out.println("Edited By Sikken@Hotmail.com");
+		System.out.println("");
         System.out.println("Please choose an option:");
         System.out.println("");
         System.out.println("1 - Create new account or update existing one (change pass and access level).");
@@ -83,6 +87,13 @@
                     System.out.print("Password: ");
                     _pass = _in.readLine();
                 }
+
+            if (_mode.equals("1"))
+                while (_email.length() == 0)
+                {
+                    System.out.print("Email: ");
+                    _email = _in.readLine();
+                }
             
             if (_mode.equals("1") || _mode.equals("2"))
                 while (_level.length() == 0)
@@ -95,7 +106,7 @@
         
         if (_mode.equals("1"))
             // Add or Update
-            addOrUpdateAccount(_uname,_pass,_level);
+            addOrUpdateAccount(_uname,_pass,_email,_level);
         else if(_mode.equals("2"))
             // Change Level
             changeAccountLevel(_uname,_level);
@@ -155,7 +166,7 @@
         System.out.println("Displayed accounts: " + count + ".");
     }
     
-    private static void addOrUpdateAccount(String account,String password, String level) throws IOException, SQLException, NoSuchAlgorithmException
+    private static void addOrUpdateAccount(String account, String password, String email, String level) throws IOException, SQLException, NoSuchAlgorithmException
     {
         // Encode Password
         MessageDigest md = MessageDigest.getInstance("SHA");
@@ -166,10 +177,11 @@
         // Add to Base
         Connection con = null;
         con = L2DatabaseFactory.getInstance().getConnection();
-        PreparedStatement statement = con.prepareStatement("REPLACE	accounts (login, password, accessLevel) VALUES (?,?,?)");
+        PreparedStatement statement = con.prepareStatement("REPLACE	accounts (login, password, email, accessLevel) VALUES (?,?,?,?)");
         statement.setString(1, account);
+        statement.setString(3, email);
         statement.setString(2, Base64.encodeBytes(newpass));
-        statement.setString(3, level);
+        statement.setString(4, level);
         statement.executeUpdate();
         statement.close();
         con.close();

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disbaled AdBlock