new ticket page update
This commit is contained in:
parent
d9088aba7a
commit
6a3edc2269
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -1,5 +1,5 @@
|
||||
$(document).ready(function () {
|
||||
//check login state
|
||||
// TODO: check login state
|
||||
console.log("page loaded");
|
||||
$.post('/senddata/checkloginstate', 'action=getloginstate', function (data) {
|
||||
console.log(data);
|
||||
|
@ -7,10 +7,10 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class jdcb {
|
||||
public class JDCB {
|
||||
Connection conn;
|
||||
|
||||
public jdcb(String username, String password, String dbname) {
|
||||
public JDCB(String username, String password, String dbname) {
|
||||
Database db = new MySQLConnector(
|
||||
username,
|
||||
password,
|
@ -1,7 +1,7 @@
|
||||
package com.wasteinformationserver.mqtt;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.jdcb;
|
||||
import com.wasteinformationserver.db.JDCB;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
@ -63,7 +63,7 @@ public class mqtt {
|
||||
|
||||
|
||||
Log.debug(message);
|
||||
jdcb Database = new jdcb("placeuser", "eaL956R6yFItQVBl", "wasteinformation");
|
||||
JDCB Database = new JDCB("placeuser", "eaL956R6yFItQVBl", "wasteinformation");
|
||||
ResultSet result = Database.executeQuery(message);
|
||||
try {
|
||||
while (result.next()) {
|
||||
|
@ -1,19 +0,0 @@
|
||||
package com.wasteinformationserver.website;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class DataRequest extends PostRequest {
|
||||
@Override
|
||||
public String request(HashMap<String, String> params) {
|
||||
switch (params.get("action")){
|
||||
case "senddata":
|
||||
Log.debug(params.toString());
|
||||
|
||||
// TODO: 11.10.19 store data in database
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -2,6 +2,10 @@ package com.wasteinformationserver.website;
|
||||
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.website.datarequests.CheckLoginState;
|
||||
import com.wasteinformationserver.website.datarequests.DataRequest;
|
||||
import com.wasteinformationserver.website.datarequests.LoginRequest;
|
||||
import com.wasteinformationserver.website.datarequests.RegisterRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.wasteinformationserver.website;
|
||||
package com.wasteinformationserver.website.basicrequest;
|
||||
|
||||
import com.sun.net.httpserver.Headers;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
@ -1,4 +1,4 @@
|
||||
package com.wasteinformationserver.website;
|
||||
package com.wasteinformationserver.website.basicrequest;
|
||||
|
||||
import com.sun.net.httpserver.Headers;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
@ -1,6 +1,7 @@
|
||||
package com.wasteinformationserver.website;
|
||||
package com.wasteinformationserver.website.datarequests;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -0,0 +1,36 @@
|
||||
package com.wasteinformationserver.website.datarequests;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.JDCB;
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class DataRequest extends PostRequest {
|
||||
@Override
|
||||
public String request(HashMap<String, String> params) {
|
||||
switch (params.get("action")){
|
||||
case "senddata":
|
||||
Log.debug(params.toString());
|
||||
|
||||
// check if wastezone and wasteregion already exists
|
||||
|
||||
JDCB jdcb = new JDCB("users", "kOpaIJUjkgb9ur6S", "wasteinformation");
|
||||
|
||||
ResultSet set = jdcb.executeQuery("select * from cities where name='"+params.get("wasteregion")+"'");
|
||||
try {
|
||||
System.out.println(set.getFetchSize());
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// jdcb.executeUpdate("insert into ");
|
||||
|
||||
// TODO: 11.10.19 store data in database
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
package com.wasteinformationserver.website;
|
||||
package com.wasteinformationserver.website.datarequests;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.jdcb;
|
||||
import com.wasteinformationserver.db.JDCB;
|
||||
import com.wasteinformationserver.website.HttpTools;
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@ -14,7 +16,7 @@ public class LoginRequest extends PostRequest {
|
||||
String password = params.get("password");
|
||||
String username = params.get("username");
|
||||
|
||||
ResultSet s = new jdcb("users", "kOpaIJUjkgb9ur6S", "wasteinformation").executeQuery("select * from user where username ='" + username + "'");
|
||||
ResultSet s = new JDCB("users", "kOpaIJUjkgb9ur6S", "wasteinformation").executeQuery("select * from user where username ='" + username + "'");
|
||||
|
||||
String response = "{\"accept\": false}";
|
||||
try {
|
@ -1,4 +1,4 @@
|
||||
package com.wasteinformationserver.website;
|
||||
package com.wasteinformationserver.website.datarequests;
|
||||
|
||||
public class LoginState {
|
||||
private LoginState() {}
|
@ -1,7 +1,9 @@
|
||||
package com.wasteinformationserver.website;
|
||||
package com.wasteinformationserver.website.datarequests;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.jdcb;
|
||||
import com.wasteinformationserver.db.JDCB;
|
||||
import com.wasteinformationserver.website.HttpTools;
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@ -12,7 +14,7 @@ public class RegisterRequest extends PostRequest {
|
||||
|
||||
String passhash = HttpTools.StringToMD5(params.get("password"));
|
||||
|
||||
jdcb myjd = new jdcb("users", "kOpaIJUjkgb9ur6S", "wasteinformation");
|
||||
JDCB myjd = new JDCB("users", "kOpaIJUjkgb9ur6S", "wasteinformation");
|
||||
int s = myjd.executeUpdate("INSERT INTO `user` (`username`, `firstName`, `secondName`, `password`, `email`, `logindate`) VALUES ('"+params.get("username")+"', '"+params.get("firstname")+"', '"+params.get("lastname")+"', '"+passhash+"', '"+params.get("email")+"', current_timestamp());");
|
||||
|
||||
// TODO: 27.09.19 detect if register process was successful and reply right json
|
Loading…
Reference in New Issue
Block a user