Login form in HTML that conects to a page to tunr on/off 2 leds

Hi, everybody… I’m having a hard time to make my code work…
I’ve got a code that asks for a login and password, than it shows some inputs and it works fine…
Login is satarun and password is password

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,2, 111);

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}

void SendOKpage(EthernetClient &client)
{
// send a standard http response header
client.println(“HTTP/1.1 200 OK”);
client.println(“Content-Type: text/html”);
client.println(“Connnection: close”);
client.println();
client.println("");
client.println("");
// add a meta refresh tag, so the browser pulls again every 5 seconds:
client.println("<meta http-equiv=“refresh” content=“5”>");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print(“analog input “);
client.print(analogChannel);
client.print(” is “);
client.print(sensorReading);
client.println(”
“);
}
client.println(””);
}

void SendAuthentificationpage(EthernetClient &client)
{
client.println(“HTTP/1.1 401 Authorization Required”);
client.println(“WWW-Authenticate: Basic realm=“Secure Area””);
client.println(“Content-Type: text/html”);
client.println(“Connnection: close”);
client.println();
client.println("");
client.println(" Error");
client.println("

401 Unauthorized.

");
}

char linebuf[80];
int charcount=0;
boolean authentificated=false;

void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println(“new client”);
memset(linebuf,0,sizeof(linebuf));
charcount=0;
authentificated=false;
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
linebuf[charcount]=c;
if (charcount<sizeof(linebuf)-1) charcount++;
Serial.write(c);
// if you’ve gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == ‘\n’ && currentLineIsBlank) {
if (authentificated)
SendOKpage(client);
else
SendAuthentificationpage(client);
break;
}
if (c == ‘\n’) {
// you’re starting a new line
currentLineIsBlank = true;
if (strstr(linebuf,“Authorization: Basic”)>0 && strstr(linebuf,“c2F0YXJ1bjpwYXNzd29yZA==”)>0)
authentificated=true;
memset(linebuf,0,sizeof(linebuf));
charcount=0;
}
else if (c != ‘\r’) {
// you’ve gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println(“client disonnected”);
}
}

The problem is that I can’t make it work when I mix both codes trying to turn on/off a led from the internet with a simple example of a Web Server 2 Leds simple code like the one below:

int led1 = 8;
int led2 = 9;
char c = 0;
char command[2] = “\0”;

void setup()

pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
}

void loop()
{
EthernetClient client = server.available();
if (client) {
boolean current_line_is_first = true;
boolean current_line_is_blank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (c == ‘\n’ && current_line_is_blank) {
client.println(“HTTP/1.1 200 OK”);
client.println(“Content-Type: text/html”);
client.println(“Refresh: 3”);
client.println();
client.println("<body background-color:#040300>");
client.println("

Welcome you!


");
client.println("
“);
client.println(”
“);
client.println(”");
client.println(“Led1 ON”);
client.println(“Led1 OFF”);
client.println("
“);
client.println(”

"); client.println("Led2 ON"); client.println("Led2 OFF"); client.println("

");

break;
}
if (c == ‘\n’) {
current_line_is_first = false;
current_line_is_blank = true;
}
else if (c != ‘\r’) {
current_line_is_blank = false;
}
if (current_line_is_first && c == ‘=’) {
for (int i = 0; i < 1; i++) {
c = client.read();
command = c;
}

if (!strcmp(command, “1”)) {
digitalWrite(led1, HIGH);
}
else if (!strcmp(command, “2”)) {
digitalWrite(led1, LOW);
}
if (!strcmp(command, “3”)) {
digitalWrite(led2, HIGH);
}
else if (!strcmp(command, “4”)) {
digitalWrite(led2, LOW);
}
}
}
}

delay(1000);
client.stop();
}

client.println("");
}

Could anybody help me putting both codes together ?

Please post your merge attempt and add code tags that time around (see the sticky on top of the forum for how to do this, and other general tips on how to make best use of this forum). Also describe in detail what it does, and what it should do. "It doesn't work" is one of the most worthless comments.

Before posting, do a CTRL-T in your IDE to fix the indentation. That, too, makes code a lot more readable.