|
@@ -1,7 +1,7 @@
|
|
|
/* This is the proccessing page of the captive portal.
|
|
/* This is the proccessing page of the captive portal.
|
|
|
* Copy right: Deben Oldert
|
|
* Copy right: Deben Oldert
|
|
|
* Here classes are called to check and update database query's and to configure iptables.
|
|
* Here classes are called to check and update database query's and to configure iptables.
|
|
|
-* Called classe are: {Database, Command}
|
|
|
|
|
|
|
+* Called classe are: {JSON, Command}
|
|
|
*/
|
|
*/
|
|
|
package captiveportal;
|
|
package captiveportal;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
@@ -29,20 +29,11 @@ public class proccess extends HttpServlet {
|
|
|
response.setContentType("text/html");
|
|
response.setContentType("text/html");
|
|
|
PrintWriter out = response.getWriter();
|
|
PrintWriter out = response.getWriter();
|
|
|
// Send user back to login form
|
|
// Send user back to login form
|
|
|
- json JSON = new json();
|
|
|
|
|
- try {
|
|
|
|
|
- JSON.grandAccess("123");
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- // TODO Auto-generated catch block
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- /*
|
|
|
|
|
try {
|
|
try {
|
|
|
out.println("<script>window.location.replace('http://portal.corendon.nl/Portal');</script>");
|
|
out.println("<script>window.location.replace('http://portal.corendon.nl/Portal');</script>");
|
|
|
} finally {
|
|
} finally {
|
|
|
out.close(); // Close the output writer
|
|
out.close(); // Close the output writer
|
|
|
- }*/
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
/**
|
|
/**
|
|
|
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
|
|
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
|
|
@@ -58,38 +49,51 @@ public class proccess extends HttpServlet {
|
|
|
String javaReturnErrorS = "<script>window.location.replace('http://portal.corendon.nl/Portal/?err=";
|
|
String javaReturnErrorS = "<script>window.location.replace('http://portal.corendon.nl/Portal/?err=";
|
|
|
String javaReturnErrorE = "');</script>";
|
|
String javaReturnErrorE = "');</script>";
|
|
|
//#####################################
|
|
//#####################################
|
|
|
|
|
+ //Start the output writer
|
|
|
PrintWriter out = response.getWriter();
|
|
PrintWriter out = response.getWriter();
|
|
|
|
|
+ //Load classes
|
|
|
Command CMD = new Command();
|
|
Command CMD = new Command();
|
|
|
json JSON = new json();
|
|
json JSON = new json();
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- if(JSON.checkUser(ticketNumber)) {
|
|
|
|
|
|
|
+ // Fallback to version 04-01-2015 (Only if you want to be a badboy)
|
|
|
|
|
+ //if(JSON.checkTicket(ticketNumber)) {
|
|
|
|
|
+ //Call to the grandAccess function in json.java
|
|
|
if(JSON.grandAccess(ticketNumber))
|
|
if(JSON.grandAccess(ticketNumber))
|
|
|
{
|
|
{
|
|
|
|
|
+ //Now lets give the user actually access to the interwebzz
|
|
|
if(CMD.Grand(request.getRemoteAddr())) {
|
|
if(CMD.Grand(request.getRemoteAddr())) {
|
|
|
exitCode = 0;
|
|
exitCode = 0;
|
|
|
}
|
|
}
|
|
|
|
|
+ //If you did not pass, say so
|
|
|
else {
|
|
else {
|
|
|
exitCode = 3;
|
|
exitCode = 3;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ //If you did not pass, say so
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
exitCode = 2;
|
|
exitCode = 2;
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ //Part of the fallback
|
|
|
|
|
+ /*}
|
|
|
else {
|
|
else {
|
|
|
exitCode = 1;
|
|
exitCode = 1;
|
|
|
- }
|
|
|
|
|
|
|
+ }*/
|
|
|
|
|
+ // what ya' gonna do, what ya' gonna do when they come for you....
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
exitCode = 4;
|
|
exitCode = 4;
|
|
|
}
|
|
}
|
|
|
|
|
+ //What to do with a exitCode?
|
|
|
switch (exitCode) {
|
|
switch (exitCode) {
|
|
|
|
|
+ //Whet could we do, what could we do...
|
|
|
case 0:
|
|
case 0:
|
|
|
|
|
+ //Eureka!! Making the path to the interwebzz
|
|
|
request.getRequestDispatcher("/loading.html").include(request, response);
|
|
request.getRequestDispatcher("/loading.html").include(request, response);
|
|
|
out.println(javaReturn0);
|
|
out.println(javaReturn0);
|
|
|
break;
|
|
break;
|
|
|
|
|
+ //For the following cases: Get back where you came from (index.html) but with a return code
|
|
|
case 1:
|
|
case 1:
|
|
|
out.println(javaReturnErrorS+exitCode+javaReturnErrorE);
|
|
out.println(javaReturnErrorS+exitCode+javaReturnErrorE);
|
|
|
break;
|
|
break;
|