thermostat project Uno/relay/ds18s20

i am working on a thermostat project for a friend using a Uno with Ethernet shield.

what we are wanting is a webpage hosted on it with 4 buttons, manual on-off and auto on-off, and displaying the temps from 3 ds18s20. we would be okay if we had to use pachube to pull the temps from the ds18s20 to display this. there is a relay connected to pin4, and 3 ds18s20 connected to pin5. i have two different codes that i have gotten to do the manual on-off via the buttons, and then the other code turns the relay on-off based on the temp sensed by one of the ds18s20.

when i merge the two codes together, the auto control of the relay overrides the manual on-off from the webpage. is there a way to add an on-off button for the auto part of the code? in the end, we would also like to be able to adjust the temp that the auto part of the code reads to on/off the relay from the webpage.

any help would be greatly appreciated.

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 10, 20, 30, 240 };                  // ip in lan
byte gateway[] = { 10, 20, 30, 254 };                  // internet access via router
byte subnet[] = { 255, 255, 255, 0 };                   //subnet mask
Server server(80);                                      //server port
byte sampledata=50;            //some sample data - outputs 2 (ascii = 50 DEC)
int relayPin4 = 4;  // relay pin 4
int relayState = HIGH;

String readString = String(30); //string for fetching data from address
boolean LEDON1 = false; //LED status flag

// Data wire is plugged into port 5 on the Arduino
#define ONE_WIRE_BUS 5
#define TEMPERATURE_PRECISION 9

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

// arrays to hold device addresses
DeviceAddress insideThermometer, outsideThermometer;

// function that will be called when an alarm condition exists during DallasTemperatures::processAlarms();
void newAlarmHandler(uint8_t* deviceAddress)
{
  Serial.println("Alarm Handler Start");
  printAlarmInfo(deviceAddress);
  printTemp(deviceAddress);
  Serial.println();
  Serial.println("Alarm Handler Finish");
}

void printCurrentTemp(DeviceAddress deviceAddress)
{
  printAddress(deviceAddress);
  printTemp(deviceAddress);
  Serial.println();
}

void printAddress(DeviceAddress deviceAddress)
{
  Serial.print("Address: ");
  for (uint8_t i = 0; i < 8; i++)
  {
    if (deviceAddress[i] < 16) Serial.print("0");
    Serial.print(deviceAddress[i], HEX);
  }
  Serial.print(" ");
}

void printTemp(DeviceAddress deviceAddress)
{
  float tempC = sensors.getTempC(deviceAddress);
  if (tempC != DEVICE_DISCONNECTED)
  {
    Serial.print("Current Temp C: ");
    Serial.print(tempC);
  }
  else Serial.print("DEVICE DISCONNECTED");
  Serial.print(" ");
}

void printAlarmInfo(DeviceAddress deviceAddress)
{
  char temp;
  printAddress(deviceAddress);
  temp = sensors.getHighAlarmTemp(deviceAddress);
  Serial.print("High Alarm: ");
  Serial.print(temp, DEC);
  Serial.print("C");
  Serial.print(" Low Alarm: ");
  temp = sensors.getLowAlarmTemp(deviceAddress);
  Serial.print(temp, DEC);
  Serial.print("C");
  Serial.print(" ");
}

void setup(){
  //start Ethernet
  Ethernet.begin(mac, ip, subnet);
  
  //Set pin 4 to output
  pinMode(relayPin4, OUTPUT);
  
  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");

  // Start up the library
  sensors.begin();

  // locate devices on the bus
  Serial.print("Found ");
  Serial.print(sensors.getDeviceCount(), DEC);
  Serial.println(" devices.");

  // search for devices on the bus and assign based on an index
  if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0");
  if (!sensors.getAddress(outsideThermometer, 1)) Serial.println("Unable to find address for Device 1");

  Serial.print("Device insideThermometer ");
  printAlarmInfo(insideThermometer);
  Serial.println();

  Serial.print("Device outsideThermometer ");
  printAlarmInfo(outsideThermometer);
  Serial.println();

  // set alarm ranges
  Serial.println("Setting alarm temps...");
  sensors.setHighAlarmTemp(insideThermometer, 26);
  sensors.setLowAlarmTemp(insideThermometer, 22);

  Serial.print("New insideThermometer ");
  printAlarmInfo(insideThermometer);
  Serial.println();

  // attach alarm handler
  sensors.setAlarmHandler(&newAlarmHandler);
}


void loop(){
  // ask the devices to measure the temperature
  sensors.requestTemperatures();

  // if an alarm condition exists as a result of the most recent
  // requestTemperatures() request, it exists until the next time
  // requestTemperatures() is called AND there isn't an alarm condition
  // on the device
  if (sensors.hasAlarm())
  {
    digitalWrite(relayPin4, LOW);
    Serial.println("LED should be OFF");
  }

  // call alarm handler function defined by sensors.setAlarmHandler
  // for each device reporting an alarm
  sensors.processAlarms();

  if (!sensors.hasAlarm())
  {
     digitalWrite(relayPin4, HIGH);
    // just print out the current temperature
    printCurrentTemp(insideThermometer);
    printCurrentTemp(outsideThermometer);
  }

  delay(1000);

  
  // Create a client connection
  Client client = server.available();
  if (client) {
    while (client.connected()) {
   if (client.available()) {
    char c = client.read();
    //read char by char HTTP request
    if (readString.length() < 30)
      {
        //store characters to string
        //-----readString.append(c);
          readString.concat(c);
      }
        //output chars to serial port
        Serial.print(c);
        //if HTTP request has ended
        if (c == '\n') {
          //lets check if LED should be lighted
 //------------LED 1
           if (readString.substring(6,11) == "L1=ON")
           {
             digitalWrite(relayPin4, HIGH);    // set the LED on
             LEDON1 = true;
           }
             else if (readString.substring(6,12) == "L1=OFF")
            {
             digitalWrite(relayPin4, LOW);    // set the LED OFF
             LEDON1 = false;
            }

          // now output HTML data starting with standart header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          //set background to yellow
          client.print("<body style=background-color:white>");
          client.println("<h1>Stove control</h1>");
          client.println("<font color='black'>");
          client.println("
");

//--------LED 1 CONTROLL--------
          client.println("Select Heating Operation <form> <form method=get name=LED><input type=submit name=L1 value=ON>");
          client.println("<form method=get name=  LED><input type=submit name=L1 value=OFF  ><form>");
                if (LEDON1)
            {
             client.print("<font color='green' size='3'> Stove is On");
            }
            else
            {
             client.print("<font color='red' size = '3'> Stove is Off");
            }
            client.println("<font color='black' 
");

          client.println("</body></html>");
          //clearing string for next read
          readString="";
          //stopping client
          client.stop();
            }
          }
        }
      }
    }