Ethernet controlled lcd status remote controll problems

Hello, sorry I am new here. Any ways, i have smashed some other codes together. TFT and ethernet controll ect. I got it to print what ever i want on startup. but for some reason no matter what i do i cannot get anything to happen in loop? not even clearing the screen! im so confused.
And before you say it yes i know i suck at coding and i did this in like a 2 hours lol

Any help appreciated.
code here

tft display: 2.8 ITDB02 Shield, V2
Ethernet Shield Moduel R3
EDIT:Arduino Mega

code here

But, your question is NOT on pastebin. Where do you want help? If here, post your code HERE.

/*
Web Server
A simple web server
Circuit:

  • Ethernet shield attached to pins 10, 11, 12, 13
    */
    //-------------------------------------------------------------------------------------------------------
    #include <SPI.h>
    #include <Ethernet.h>

#include <UTFT.h>
extern uint8_t SmallFont[];
UTFT myGLCD(ITDB28,A5,A4,A3,A2);

// Enter a MAC address and IP address for your controller below.
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0x48, 0xD3 };

// The IP address will be dependent on your local network:
// assign an IP address for the controller:

IPAddress ip(10,80,45,254);
IPAddress gateway(10,80,45,211);
IPAddress subnet(255, 255, 255, 0);

// Initialize the Ethernet server library with the port you want to use.
EthernetServer server(80);
String readString;
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------
// Any extra codes for Declaration :

// Declare Pin 8 as an LED because thats what we will be connecting the LED to.You could use any other pin and would then have to change the pin number.

//-------------------------------------------------
//-------------------------------------------------------------------------------------------------------
void setup()
{
pinMode(53, OUTPUT);
pinMode(51, OUTPUT);
pinMode(47, OUTPUT);
pinMode(49, OUTPUT);
pinMode(45, OUTPUT);
pinMode(43, OUTPUT);
digitalWrite(51, LOW);
digitalWrite(47, LOW);
digitalWrite(43, LOW);

//-------------------------------------------------

// Extra Set up code:

//-------------------------------------------------
//-------------------------------------------------------------------------------------------------------
//enable serial data print
randomSeed(analogRead(0));

// Setup the LCD
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
int buf[318];
int x, x2;
int y, y2;
int r;

// Clear the screen and draw the frame
myGLCD.clrScr();

myGLCD.setColor(255, 0, 0);
myGLCD.fillRect(0, 0, 319, 13);
myGLCD.setColor(64, 64, 64);
myGLCD.fillRect(0, 226, 319, 239);
myGLCD.setColor(255, 255, 255);
myGLCD.setBackColor(255, 0, 0);
myGLCD.print("LED LCD REMOTE CONTROLLER", CENTER, 1);
myGLCD.setBackColor(64, 64, 64);
myGLCD.setColor(255,255,0);
myGLCD.print("ACCESS: 10.80.45.254", CENTER, 227);
myGLCD.setBackColor(0,0, 0);
myGLCD.setColor(255,255,255);
myGLCD.print("LED ONE: OFF", CENTER, 16);
myGLCD.print("LED TWO: OFF", CENTER, 32);
myGLCD.print("LED THREE: OFF", CENTER, 48);
Serial.begin(9600);

//start Ethernet
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
Serial.print("Server is at ");
Serial.println(Ethernet.localIP());
Serial.println("LED Controller Test 1.0");
}
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------

void loop(){

int buf[318];
int x, x2;
int y, y2;
int r;
digitalWrite(51, LOW);
digitalWrite(47, LOW);
digitalWrite(43, LOW);
// listen for incoming clients
EthernetClient client = server.available();
if (client)

{
Serial.println("new client");

while (client.connected())
{
if (client.available())

{
char c = client.read();

//read char by char HTTP request
if (readString.length() < 100)

{

//store characters to string
readString += c;
//Serial.print(c);

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 HTTP request has ended
if (c == '\n') {
Serial.println(readString); //print to serial monitor for debuging
//--------------------------------------------------------------------------------------------------------
// Needed to Display Site:
client.println("HTTP/1.1 200 OK"); //send new page
client.println("Content-Type: text/html");
client.println();
client.println("");
client.println("");

//--------------------------------------------------------------------------------------------------------
//-------------------------------------------------

// what is being Displayed :

//-------------------------------------------------
// Code which needs to be Implemented:
if(readString.indexOf("?L1ON")>0)
{
digitalWrite(53, HIGH); // set pin 8 high
myGLCD.clrScr();
myGLCD.setColor(255,255,255);
myGLCD.print("LED ONE: ON", CENTER, 16);
Serial.println("LED 1 ON");
client.stop();
Serial.println("client disonnected");

}else
if(readString.indexOf("?L1OFF")>0)
{
digitalWrite(53, LOW); // set pin 8 high
myGLCD.print("LED ONE: OFF", CENTER, 16);
Serial.println("LED 1 OFF");
client.stop();
Serial.println("client disonnected");

}else
if(readString.indexOf("?L2ON")>0)
{
digitalWrite(49, HIGH); // set pin 8 high
myGLCD.print("LED TWO: ON", CENTER, 32);
Serial.println("LED 2 ON");
client.stop();
Serial.println("client disonnected");

}else
if(readString.indexOf("?L2OFF")>0 )
{
digitalWrite(49, LOW); // set pin 8 high
myGLCD.print("LED TWO: OFF", CENTER, 32);
Serial.println(" LED 2 OFF");
client.stop();
Serial.println("client disonnected");

}else
if(readString.indexOf("?L3ON")>0)
{
digitalWrite(45, HIGH); // set pin 8 high
myGLCD.print("LED THREE: ON", CENTER, 48);
Serial.println("LED 3 ON");
client.stop();
Serial.println("client disonnected");
}else
if(readString.indexOf("?L3OFF")>0)
{
digitalWrite(45, LOW); // set pin 8 high
myGLCD.print("LED THREE: OFF", CENTER, 48);
Serial.println("LED 3 OFF");
client.stop();
Serial.println("client disonnected");
}
//clearing string for next read

readString="";

// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disonnected");

}
}
}
}
}
}

void setup()
{
  int buf[318];
  int x, x2;
  int y, y2;
  int r;

Why are you declaring these variables, when you don't use them before they go out of scope?

void loop(){
 
  int buf[318];
  int x, x2;
  int y, y2;
  int r;
  digitalWrite(51, LOW);

The only reason for putting the { on the same line as the statement that it goes with is to save line. You look pretty silly when you then follow that with a blank line.

You look pretty silly diddling with the SPI pins in loop(), too, since they are how the ethernet shield and the Arduino communicate.

SPI pins? 43-53 arent spi pins are they? im so confused lol
and like i said i suck at coding i came here for help bashing aint helping

50-53 are the Mega SPI pins.
If your shields are not Mega shields, you can add jumpers over to 10-13 so the shields can pick up the SPI signals there. Then leave 10-13 as INPUTs so other parts of your sketch don't mess them up.
Or they might pick them up on the ICSP header (SCK, MISO, MOSI anyway, and slave selects from elsewhere).

The lcd display works just fine with the demo code. what i dont get is why the loop in my code wont work, even after removing the interfearing SPI pins from the code.....

tnd_blazer:
The lcd display works just fine with the demo code. what i dont get is why the loop in my code wont work, even after removing the interfearing SPI pins from the code.....

You made some code changes, and didn't show is the new code.
The new code does something, but you couldn't be bothered saying what it does.
You did something that should cause the loop() method to generate some output somewhere. You couldn't be bothered saying what you did.

And, yet, you want us to tell you what to change in the code? Doesn't seem likely, does it?

I just threw it all together from scratch. Im not sure how i botched that other one but this one works just fine.
Needs a little more work but the problem i had is gone now. good to go lol.

#include <SPI.h>
#include <Ethernet.h>
#include <UTFT.h>
extern uint8_t SmallFont[];
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(10, 80, 45, 254);
EthernetServer server(80);
UTFT myGLCD(ITDB28,A5,A4,A3,A2);
void setup()
{
   randomSeed(analogRead(0));
  myGLCD.InitLCD();
  myGLCD.setFont(SmallFont);
  //Added bit of code for ethernet support
  Ethernet.begin(mac, ip);
  server.begin();
  myGLCD.clrScr();
  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRect(0, 0, 319, 13);
  myGLCD.setColor(64, 64, 64);
  myGLCD.fillRect(0, 226, 319, 239);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.print("* UTFT TEST WORKING *", CENTER, 1);
  
}
void loop()
{
  int buf[318];
  int x, x2;
  int y, y2;
  int r;
  
  
  
  EthernetClient client = server.available();
  if (client) {
    myGLCD.print("new client", CENTER, 16);
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");  // the connection will be closed after completion of the response
          client.println("Refresh: 5");  // refresh the page automatically every 5 sec
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          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("</html>");
          break;
        }
        if (c == '\n') {
          currentLineIsBlank = true;
        } else if (c != '\r') {
          currentLineIsBlank = false;
        }
      }
    }
    delay(1);
    client.stop();
    myGLCD.print("client disconnected", CENTER, 16);
    Ethernet.maintain();
  }
}