Password protect my Ethernet Web Server - SOLVED

rest of the code to follow the above code ( forum limitation on number of characters in a post )

   if (strstr(buffer,"logform")) {    /* Is logform keyword present?         */
    Serial.println("Found logform");
    if (strstr(buffer,myPass)) {    /* Is password present?                */
     Serial.println("Found myPass");
 
     // clear the rest of the incoming buffer
     char c = client.read();
     if (readString.length() < 100) {         // read char by char HTTP request
       readString += c;                       // store characters to string 
     } 
     if (c == '\n') {                         // if HTTP request has ended - blank line received
      Serial.println("Header Flushed");
     }
 
     /* Login form processing */
 
     // get the first open passID storage space and create a new session ID.
     for (int i=0; i < passCount; i++){
      if (passIDvalid == 0 && passIDstart[i] == 0){
       passIDstart[i] = currentMillis;  // set the variable to use as the passID
       passIDlast[i] = currentMillis;   // set the last time the passID was used
       passIDvalid = passIDstart[i];
       Serial.print("New alocated passID = ");
       Serial.print(passIDvalid);
       Serial.print(" in array space ");
       Serial.println(i);
       LastAction = "Login Completed";
      }
     }                     // end of loop for get the first open passID storage space
    }                         // end: if password is present
   }                             // end: if logform in line
 
   Serial.println("Processing input");
 
   // clear expired passIDs from array - housekeeping each time a server connection is made
   for (int i=0; i < passCount; i++){
    if (passIDstart[i] != 0){
       if (currentMillis >= passExpireMil){
      if (currentMillis - passIDlast[i] >= passExpireMil){
       passIDstart[i] = 0;
       Serial.print("Cleared passIDstart ");
       Serial.println(i);
      }
     }
    }
   }
 
   unsigned int GotAction = 0;   // shows that no DoAction command received
 
   // look for DoAction commands in the input buffer
   if (strstr(buffer,"DoAction")) {    /* If DoAction keyword is present         */
    Serial.println("Found DoAction keyword");
    Serial.println("Looking for valid passID");
 
    //see if a valid passID exists in the DoAction line
    for (int i=0; i < passCount; i++){
 
     if (GotAction == 0 && passIDstart[i] != 0){
 
      ltoa(passIDstart[i],xx1,10);  // convert the long to char
 
      //check for the passID + DoAction keyword + action code in the buffer
 
      JoinedChar[0] = '\0';               // clear the destination array
      strcat(JoinedChar, xx1);            //add the passID to the array
      strcat(JoinedChar, DoAction);       //add the keyword to the array
      strcat(JoinedChar, "on001");        //add the action code to the array
       if (strstr(buffer,JoinedChar)) GotAction = 1;
 
      JoinedChar[0] = '\0';               // clear the destination array
      strcat(JoinedChar, xx1);            //add the passID to the array
      strcat(JoinedChar, DoAction);       //add the keyword to the array
      strcat(JoinedChar, "on002");        //add the action code to the array
       if (strstr(buffer,JoinedChar)) GotAction = 2;
 
      JoinedChar[0] = '\0';               // clear the destination array
      strcat(JoinedChar, xx1);            //add the passID to the array
      strcat(JoinedChar, DoAction);       //add the keyword to the array
      strcat(JoinedChar, "on003");        //add the action code to the array
       if (strstr(buffer,JoinedChar)) GotAction = 3;
 
      if(GotAction != 0){
       Serial.print("Found DoAction ");
       Serial.print(GotAction);
       Serial.print(" for passID : ");
       Serial.println(passIDstart[i]);
       passIDlast[i] = currentMillis;   //renew the last time that the passID was used
       passIDvalid = passIDstart[i];
      }
     }
    }
 
    if(GotAction != 0){
 
     // clear the rest of the incoming buffer
     char c = client.read();
     if (readString.length() < 100) {         // read char by char HTTP request
       readString += c;                       // store characters to string 
     } 
     if (c == '\n') {                         // if HTTP request has ended - blank line received
      Serial.println("Header Flushed");
     }
 
     /* DoAction processing */
 
     if(GotAction == 1){
      Serial.println("Received Web Server command on001");
      // do tasks in response to command 1 received
      LastAction = "Command on001 processed";
     }
     if(GotAction == 2){
      Serial.println("Received Web Server command on002");
      // do tasks in response to command 2 received
      LastAction = "Command on002 processed";
     }
     if(GotAction == 3){
      Serial.println("Received Web Server command on003");
      // do tasks in response to command 3 received
      LastAction = "Command on003 processed";
     }
    }
   }
   
 
   //display the web page
   client.println("HTTP/1.1 200 OK"); //send new page
   client.println("Content-Type: text/html");
   client.println();
   client.println("<HTML>");
   client.println("<HEAD>");
   client.println("<STYLE TYPE=\"text/css\"><!--");     //set the style for the page to Courier New
   client.println("BODY   {   font-family:Courier New;   }");
   client.println("--></STYLE>");
   client.println("<TITLE>Home Control</TITLE>");       //browser tab title
   client.println("</HEAD>");
   client.println("<BODY>");                            //start of body section
   client.println("Home Control

");
   client.print("Current Millis value = ");
   client.print(currentMillis);
   client.println("

");
   client.print("Last Action : ");
   client.print(LastAction);
   client.println("

");
 
   if (passIDvalid == 0){  // this is not a valid passID - ask for the password
    client.print ("<form method=get>");
    client.print ("<input type=password name=logform size=10>");
    client.print (" <input type=submit value=Login>");
    client.print ("</form>");
   }
 
   if (passIDvalid != 0){  // this IS a valid passID - display the web page
 
    client.print("System : <a href=\"./?");
    client.print(passIDvalid);
    client.print("DoActionon001");
    client.println("\"\">[Command 1]</a>

"); 
 
    client.print("System : <a href=\"./?");
    client.print(passIDvalid);
    client.print("DoActionon002");
    client.println("\"\">[Command 2]</a>

"); 
 
    client.print("System : <a href=\"./?");
    client.print(passIDvalid);
    client.print("DoActionon003");
    client.println("\"\">[Command 3]</a>

"); 
   }
 
   client.println("</BODY>");
   client.println("</HTML>");
   delay(1);
   
   client.stop();                /* Disconnect from the server          */
  }                                /*  end: while client connected        */
 }                                   /*  end: if client connection          */
}                                      /*  end: loop()                        */