This file was deleted.

@@ -1,4 +1,4 @@
package Game;


import java.awt.EventQueue;

@@ -14,7 +14,7 @@
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class LoginGUI {
public class MainGui {

private JFrame frame;
private JPasswordField passwordField;
@@ -27,7 +27,7 @@ public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
LoginGUI window = new LoginGUI();
MainGui window = new MainGui();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
@@ -39,7 +39,7 @@ public void run() {
/**
* Create the application.
*/
public LoginGUI() {
public MainGui() {
initialize();
}

@@ -11,8 +11,9 @@ public class ConnectionMySQL {

private String url = "jdbc:mysql://localhost:3306";
private String user = "root";
private String password = "";
private String password = "Password123!";
private String answer, column;
private int dataInput;
ResultSet res;
Statement stt;

@@ -38,6 +39,18 @@ public String getData(int userId, String col) {
}
if(col.equals("ba")){
column = "userBalance";
}else if(col.equals("na")){
column = "userName";
}else if(col.equals("pa")){
column = "userPassword";
}else if(col.equals("di")){
column = "userDifficulty";
}else if(col.equals("mo")){
column = "userMode";
}else if(col.equals("sk")){
column = "userSkip";
}else{
System.out.println("column text error (ConnectionMySQL)");
}

try {
@@ -52,6 +65,43 @@ public String getData(int userId, String col) {
}

public void setData(int userId, String col, String data) {
if(col.equals("ba")){
column = "userBalance";
dataInput = Integer.parseInt(data);
}else if(col.equals("na")){
column = "userName";
}else if(col.equals("pa")){
column = "userPassword";
}else if(col.equals("di")){
column = "userDifficulty";
dataInput = Integer.parseInt(data);
}else if(col.equals("mo")){
column = "userMode";
dataInput = Integer.parseInt(data);
}else if(col.equals("sk")){
column = "userSkip";
dataInput = Integer.parseInt(data);
}else{
System.out.println("column text error (ConnectionMySQL)");
}
if(column.equals("userName") || column.equals("userPassword")){
try {
stt.execute("UPDATE user SET " + column + " = " + data + " WHERE id=" + userId);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
try {
stt.execute("UPDATE user SET " + column + " = " + dataInput + " WHERE id=" + userId);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}



System.out.println("userId: " + userId + " col: " + col + " data: " + data);
}
}
@@ -32,7 +32,6 @@ private void deCode(String cS) {
k = i;
break;
}
System.out.println(i);
}
System.out.println("The id found is:" + ID.substring(0,k)+ ":");

@@ -3,7 +3,7 @@
import java.io.*;
import java.net.*;

import Game.User;
import Client.User;


class TCPServer{
@@ -22,11 +22,13 @@ public static void main(String argv[]) throws Exception{
Socket connectionSocket = welcomeSocket.accept();
BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream()));
DataOutputStream outToClient = new DataOutputStream(connectionSocket.getOutputStream());

clientSentence = inFromClient.readLine();
System.out.println("Received: " + clientSentence);
D.doData(clientSentence);
if(D.returnData()){
outToClient.writeBytes(D.answer());
System.out.println(D.answer() + " reached 'out to client'");
outToClient.writeBytes(D.answer()+'\n');
}
}
}