Receive the state of a pin by the ethernet shield

Hello,

I have my own code, I can control the lights from the web at a specific ip adress (http://192.168.1.99/) so when I type http://192.168.1.99/?a2 my light on pin 2 is ON.
I make a website for have an interface.
Picture here : Screenshot by Lightshot
(yes I'm French ^^)

So my program works perfectly.
But for my school I created a website and make a space for signup login and other things. So when the user come on my website they can add lights in a form like this :

  • Ip adress (it's a real website, but if the card is in local network it work)
  • Name (like ClassRoom 2.....)
  • Command for light on (a2 for pin 2, a3 for pin 3...... (but no pin 4))
  • Command for light off (e2 for pin 2, e3 for pin 3...... (but no pin 4))

After they click on submit and they see the lamp "Classroom 2" with two buttons "ON" & "OFF" (iframe, javascript button) and they can turn on and turn off the lights.

But I have a problem :

I want to add to my homepage a system for see what lamp is actually ON. But I'm desperate because I really don't know how to do that. I already try the make this code in Arduino :

if(readString.indexOf("?a2") >0)      //a2 for turn ON pin 2, when light 2
          {
            digitalWrite(2, HIGH);
            Serial.println("al2");
            client.println("Lampe 2 allumée");     //In English it's "Lamp 2 is turned ON"       
          }

But if I turn ON my light, close the website page, come again like I never go on this website the message is not here. And if it's work, how to send it to my real web site ?

Thank you very much
You can also have my sourcecode here :

Thanks again

I remake my post, top of this topic.

thank you