X10 webserver with button control HTML video

HI I adopted the code that was posted by @zoomkat and tried to extend it a bit by using adding a timed function.

My project in a nutshel, my aim is to control lights from the internet and put them in timed control as well. I will be switching between two modes using a physical button to start with. I have the timed control working separately and the webserver working separately. The problem I am having is combining the two codes. When the switch is high its supposed to go to the timed function and turn on/off the lights according to the set times, its not doing so at the moment. Please help any pointers?

The other problem is I can access the web page on my laptop but not on my phone pr any other laptop. The ES is stacked on to the UNO and the uno is connected to my laptop via ethernet cable and laptop is connect to a wireless network. The code is below:

I have attached the code

Webserver___Timer_forum.ino (7.59 KB)