瀏覽代碼

Update proccess.java

Deben Oldert 11 年之前
父節點
當前提交
d6b9dc23fa
共有 1 個文件被更改,包括 18 次插入14 次删除
  1. 18 14
      captiveportal/proccess.java

+ 18 - 14
captiveportal/proccess.java

@@ -1,7 +1,7 @@
 /* 	This is the proccessing page of the captive portal.
 *	Copy right: Deben Oldert
 *	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;
 import java.io.IOException;
@@ -29,20 +29,11 @@ public class proccess extends HttpServlet {
 	      response.setContentType("text/html");
 	      PrintWriter out = response.getWriter();
 		// 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 {
 	    	  out.println("<script>window.location.replace('http://portal.corendon.nl/Portal');</script>");
 	      	} finally {
 	      		out.close();  // Close the output writer
-	      	}*/
-
+	      	}
 	}
 	/**
 	 * @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 javaReturnErrorE = "');</script>";
 	      //#####################################
+	      //Start the output writer
 	      PrintWriter out = response.getWriter();
+	      //Load classes
 	      Command CMD = new Command();
 	      json JSON = new json();
 
 	      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))
 					{
+					//Now lets give the user actually access to the interwebzz
 					if(CMD.Grand(request.getRemoteAddr())) {
 					  exitCode = 0;
 					}
+					//If you did not pass, say so
 					else {
 						exitCode = 3;
 					}
 				}
+				//If you did not pass, say so
 				else
 					{
 					exitCode = 2;
 					}
-			}
+			//Part of the fallback
+			/*}
 			else {
 				exitCode = 1;
-			}
+			}*/
+			// what ya' gonna do, what ya' gonna do when they come for you....
 		} catch (Exception e) {
 			e.printStackTrace();
 			exitCode = 4;
 		}
+	    //What to do with a exitCode?
 	    switch (exitCode) {
+	    //Whet could we do, what could we do...
 	    case 0:
+	    	//Eureka!! Making the path to the interwebzz
 	    	request.getRequestDispatcher("/loading.html").include(request, response);
 	    	out.println(javaReturn0);
 	    	break;
+	    //For the following cases: Get back where you came from (index.html) but with a return code
 	    case 1:
 	    	out.println(javaReturnErrorS+exitCode+javaReturnErrorE);
 	    	break;