|
|
בבקשה, שמח שיכולתי לעזור![]()
אני מנסה לעשות אותו דבר וזה לא עובד גם עם CTRL+SHIFT+I יש יותר מדי שגיאות וזה לא מתקן את זה
עריכה:init:
deps-jar:
Created dir: C:\Nexon\build
Updating property file: C:\Nexon\build\built-jar.properties
Created dir: C:\Nexon\build\classes
Created dir: C:\Nexon\build\empty
Created dir: C:\Nexon\build\generated-sources\ap-source-output
Compiling 437 source files to C:\Nexon\build\classes
C:\Nexon\Maple Blade\src\client\AutoRegister.java:19: incompatible types
found : java.sql.Connection
required: com.mysql.jdbc.Connection
Connection con = DatabaseConnection.getConnection();
C:\Nexon\Maple Blade\src\client\AutoRegister.java:20: incompatible types
found : java.sql.PreparedStatement
required: com.mysql.jdbc.PreparedStatement
PreparedStatement ps = con.prepareStatement("SELECT name, lastknownip FROM accounts");
C:\Nexon\Maple Blade\src\client\AutoRegister.java:45: incompatible types
found : java.sql.Connection
required: com.mysql.jdbc.Connection
Connection con = DatabaseConnection.getConnection();
C:\Nexon\Maple Blade\src\client\AutoRegister.java:46: incompatible types
found : java.sql.PreparedStatement
required: com.mysql.jdbc.PreparedStatement
PreparedStatement ps = con.prepareStatement("INSERT INTO accounts (name, password, email, birthday, macs, lastknownip) VALUES (?, ?, ?, ?, ?, ?)");
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 errors
C:\Nexon\nbproject\build-impl.xml:596: The following error occurred while executing this line:
C:\Nexon\nbproject\build-impl.xml:242: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 1 second)
בטעות מחכתי את הSRC אז העתקתי אותו מחדש מהתיקיה אבל עכשיו זה לא מתקן כמו קודם![]()
תחליף את ה Imports האלה
באלהקוד PHP:import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
קוד PHP:import java.sql.Connection;
import java.sql.PreparedStatement;
ב AutoRegister.java
אין שם במה שאתה הבאת לי
אתה הבאת לי את זה:
מה אני אמור להחליף או להחליף במקורי (אם יש )public class AutoRegister {
private static final Map<String, String> accountList = new HashMap<String, String>();
public static boolean getAccountExists(String login) {
if (accountList.isEmpty()) {
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT name, lastknownip FROM accounts");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
accountList.put(rs.getString("name").toLowerCase(), rs.getString("lastknownip"));
}
rs.close();
ps.close();
} catch (Exception e) {
System.out.println("Error loading the account list: " + e + ".");
}
}
return accountList.containsKey(login);
}
public static boolean createAccount(String login, String pwd, String eip) {
boolean success = false;
int countIP = 0;
String eIP = eip.substring(1, eip.lastIndexOf(':'));
for (String ips : accountList.values()) {
if (ips.equals(eIP)) {
countIP++;
}
}
if (5 > countIP) {
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO accounts (name, password, email, birthday, macs, lastknownip) VALUES (?, ?, ?, ?, ?, ?)");
ps.setString(1, login);
ps.setString(2, sha1(pwd));
ps.setString(3, "no@email.provided");
ps.setString(4, "0000-00-00");
ps.setString(5, "00-00-00-00-00-00");
ps.setString(6, eIP);
ps.executeUpdate();
ps.close();
success = true;
accountList.put(login.toLowerCase(), eIP);
} catch (Exception e) {
System.out.println("Error creating an account (" + login + " | " + pwd + " | " + eip + ").");
}
}
return success;
}
private static String sha1(String in) {
try {
MessageDigest Digester = MessageDigest.getInstance("SHA-1");
Digester.update(in.getBytes("UTF-8"), 0, in.length());
byte[] sha1Hash = Digester.digest();
return HexTool.toString(sha1Hash).replace(" ", "").toLowerCase();
} catch (NoSuchAlgorithmException ex) {
throw new RuntimeException("Hashing the password failed: ", ex);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Encoding the string failed: ", e);
}
}
}
אחרי שעשית ctrl + shift + i זה מוסיף לך Imports למעלה אז תחליף כמו שאמרתי
שמח שיכולתי לעזור![]()
יש מדריך שתמיר פרסם אני אחפש ויפרסם אותו.
אך מתי כבר תבחיני
בין הטוב והרע ותביני
אני לא אלוהים לא אינני
אני רק בן-אדם אוהב הנניספוילר:
מי שצריך עזרה שיצטט או ישלח פרטית