Ethernet Issue?

EDIT- main issue fixed, however ....

Is it easy enough to modify this code for a static IP?

/*********************** Marque's Arduino Controller Example ***********************/
/***********************  for questions: marque.l@gmail.com  ***********************/
/*
In the android app settingsscreen you can set up you IP and port.
For this example you need to call prefix 1 "B" and prefix 2 "C".
*/
#include <Ethernet.h>
#include <HTTPClient.h>
#include <SPI.h>

int RecievedString;
int valueB;
int valueC;
String readString = String(20);

int Relay240v1 = 1;
int Relay240v2 = 2;
int Relay24v1 = 5;
int Relay24v2 = 6;
int Relay24v3 = 7;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
EthernetServer server(80);   // port to listen on
EthernetClient client;

char content_main_top[] = "<body bgcolor=#101010><font color=white><center>";
char S1[] = "240v Relay 1 is On" ;
char S2[] = "240v Relay 1 is oOff" ;
char S3[] = "240v Relay 2 is On";
char S4[] = "240v Relay 2 is Off";
char S5[] = "24v Relay 1 is On";
char S6[] = "24v Relay 1 is Off";
char S7[] = "24v Relay 2 is Off";
char S8[] = "24v Relay 2 is Off";
char S9[] = "24v Relay 3 is Off";
char S10[] = "24v Relay 3 is Off";
char S404[] = "Not Found";

/************************** Setup **********************/
void setup() 
{
  Serial.begin(9600); 
  Serial.println("Getting IP......");
  Ethernet.begin(mac);
  Serial.print("My IP address: ");
  Ethernet.localIP().printTo(Serial);
  Serial.println();
  Serial.print("Gateway IP address is ");
  Ethernet.gatewayIP().printTo(Serial);
  Serial.println();
  Serial.print("DNS IP address is ");
  Ethernet.dnsServerIP().printTo(Serial);
  Serial.println();
  
  pinMode(Relay240v1, OUTPUT);
  pinMode(Relay240v2, OUTPUT);
  pinMode(Relay24v1, OUTPUT);
  pinMode(Relay24v2, OUTPUT);
  pinMode(Relay24v3, OUTPUT);
  
  digitalWrite(Relay240v1, LOW);
  digitalWrite(Relay240v2, LOW);
  digitalWrite(Relay24v1, LOW);
  digitalWrite(Relay24v2, LOW);
  digitalWrite(Relay24v3, LOW);
}
void loop() 
{

checkclient();
}

void checkclient()
{
  EthernetClient client = server.available();
  if (client)   
  {
    boolean sentHeader = false;
    while (client.connected())
    {
      if (client.available())
      {
        if(!sentHeader){
        client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          sentHeader = true;
        }
         char c = client.read(); 
         if (readString.length() < 20) 
         Serial.print(c);
         {readString.concat(c);}
         if (c == 'H')
         {
           Serial.println();
           int Is = readString.indexOf("/");
           int Iq = readString.indexOf("?");
           int Ib = readString.indexOf("b");
           int Ic = readString.indexOf("c");
           if(readString.indexOf("?") > 1)
           { 
             if (Ib == (Iq+1))
             {
               char carray[5];
               readString.toCharArray( carray,5,(Ib+1));
               Serial.println(carray);
                valueB = atof(carray);
               Serial.print("B is now: ");
               Serial.println(valueB);
               client.print (content_main_top);
               client.print("B is now: ");
               client.print(valueB);
             }
            else if (Ic == (Iq+1))
             {
               char carray[5];
               readString.toCharArray( carray,5,(Ic+1));
               Serial.println(carray);
                valueC = atof(carray);
               Serial.print("C is now: ");
               Serial.println(valueC);
               client.print (content_main_top);
               client.print("C is now: ");
               client.print(valueC);
             }
             else
             {
               char carray[2];
               readString.toCharArray( carray,2,(Iq+1));
               RecievedString = atoi(carray);
               switch (RecievedString) {
               case 1: action(1, client);digitalWrite(Relay240v1, HIGH);break;
               case 2: action(2, client);digitalWrite(Relay240v1, LOW);break;
               case 3: action(3, client);digitalWrite(Relay240v2, HIGH);break;
               case 4: action(4, client);digitalWrite(Relay240v2, LOW);break;
               case 5: action(5, client);digitalWrite(Relay24v1, HIGH);break;
               case 6: action(6, client);digitalWrite(Relay24v1, LOW);break;
               case 7: action(7, client);digitalWrite(Relay24v2, HIGH);break;
               case 8: action(8, client);digitalWrite(Relay24v2, LOW);break;
               case 9: action(9, client);digitalWrite(Relay24v3, HIGH);break;
               case 10: action(10, client);digitalWrite(Relay24v3, LOW);break;
               default: action(404, client);
               }
             }
          delay(1);
             client.stop();
             readString="";
             client.read(); client.read();
           }
         if (Iq < 0)
         {
         action(404, client);
         delay(1);
         client.stop();
         readString="";
         client.read(); client.read();
         }
          delay(1);
         client.stop();
         readString="";
         client.read(); client.read();
       }
     }
   }
 }
}

void action(int x, EthernetClient client)
{  
  if (x == 1) 
  {client.print (content_main_top);
   client.println(S1);
   Serial.println(S1);
  }
if (x == 2) 
  {client.print (content_main_top);
   client.println(S2);
   Serial.println(S2);
  }
if (x == 3) 
  {client.print (content_main_top);
   client.println(S3);
   Serial.println(S3);
  }
if (x == 4) 
  {client.print (content_main_top);
   client.println(S4);
   Serial.println(S4);
  }
if (x == 5) 
  {client.print (content_main_top);
   client.println(S5);
   Serial.println(S5);
  }
if (x == 6) 
  {client.print (content_main_top);
   client.println(S6);
   Serial.println(S6);
  }
  if (x == 7) 
  {client.print (content_main_top);
   client.println(S7);
   Serial.println(S7);
  }
  if (x == 8) 
  {client.print (content_main_top);
   client.println(S8);
   Serial.println(S8);
  }
  if (x == 9) 
  {client.print (content_main_top);
   client.println(S9);
   Serial.println(S9);
  }
  if (x == 10) 
  {client.print (content_main_top);
   client.println(S10);
   Serial.println(S10);
  }
if (x == 404) 
  {client.print (content_main_top);
   client.println(S404);
   Serial.println(S404);
  }
x=0;
}

In your first code, you haven't defined a DHCP server or an IP address. Where do you expect the IP address to come from?

In the second code, no gateway or netmask are defined. Is the IP address known by your router to be the Arduino's IP address?

PaulS:
In your first code, you haven't defined a DHCP server or an IP address. Where do you expect the IP address to come from?

In the second code, no gateway or netmask are defined. Is the IP address known by your router to be the Arduino's IP address?

The first code at the moment spits out the IP via the serial monitor and I have that working, but will try at adding it in manually, little clueless!

It seems that pins 0 + 1 are constantly high, and cannot be set with a digitalWrite LOW in the setup which is annoying, on top of that when I plug in my relays two will always activate for no apparent reason, If I unplug the headers and use a jumper wire and touch the pin to the relay with just one it doesn't go HIGH. very odd.

It seems that pins 0 + 1 are constantly high, and cannot be set with a digitalWrite LOW in the setup which is annoying, on top of that when I plug in my relays two will always activate for no apparent reason, If I unplug the headers and use a jumper wire and touch the pin to the relay with just one it doesn't go HIGH. very odd.

They are the serial port pins. If you are going to use Serial.begin(), Serial.print(), etc., you can not use pins 0 and 1 for other things, too.