Pin always on High and Ethernet not working

I'm trying to make a simple project on an Uno board.
I'm using an ethernet shield (W5100) to control a pin by sending a char through my lan. I used the WebServer example as a template, just adding the pin inizialization code, and an if statement for the char test; I even kept the rest of the code, as I was thinking about adding a webUi to control it with something else than my phone. Here is the code:

#include <SPI.h>
#include <Ethernet.h>
int pin=7;

byte mac[] = { 
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,177);

EthernetServer server(8092);

void setup() {
  Serial.begin(9600);
   while (!Serial) {
  }
 pinMode(pin, OUTPUT);
  
  Ethernet.begin(mac, ip);
  server.begin();
}


void loop() {
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        if (c == '\n' && currentLineIsBlank) {
          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;
        }
        if (c =='a')
        {
          digitalWrite(pin,HIGH );
          delay(1000);
          digitalWrite(pin, LOW);
        }
      }
    }
    delay(1);
    client.stop();
    Serial.println("client disconnected");
  }
}

However, as per the title, as soon as I power on the board (with everything already connected), the led I'm using for testing turns on, without me doing anything. Checking on the router, no device is connected to the selected IP.
This happens with every pin I tried.
I followed the instructions on this site for everything, so I can't get what I'm doing wrong, and I'm not knowledgeable enough to actually troubleshoot the board itself without some directions.