Multiple RFID accepted cards

Hello guys,

This code says that you can add multiple cards, but im not sure how to do so.
Any example would be appreciated.

/*
PINOUTS OF RFID CARD READER >> ARDUINO PINS
SDA >> 10
SCA >> 13
MOSI >> 11
MISO >> 12
RST >> 9
LED1 >> 6
*/
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 9
const int LED1 = 6;
const int LED2 = 7;
const int RELAY1 = 5;
MFRC522 mfrc522(SS_PIN, RST_PIN);
void setup() 
{
  Serial.begin(9600);   // Initiate a serial communication
  SPI.begin();      // Initiate  SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(RELAY1, OUTPUT);
  digitalWrite(LED1,LOW);
  digitalWrite(LED2,LOW);
  digitalWrite(RELAY1,HIGH);
  Serial.println("Put your card to the reader...");
  Serial.println();
}
void loop() 
{
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) 
  {
    return;
  }
  //Show UID on serial monitor
  Serial.print("UID tag :");
  String content= "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++) 
  {
     Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();
  if (content.substring(1) == "59 B7 BE D4") //change here the UID of the card/cards that you want to give access
  {    Serial.println("Authorized access");
    Serial.println();
    digitalWrite(LED1, HIGH);
    digitalWrite(LED2, LOW);
    digitalWrite(RELAY1, LOW);
    delay(10000);
    digitalWrite(LED1, LOW);
    digitalWrite(LED2, HIGH);
    digitalWrite(RELAY1, HIGH);
  }
  else 
  //if (content.substring(1) == "6A 34 D9 AB") 
  {
    Serial.println(" Access denied"); 
    Serial.println();
    digitalWrite(LED1, LOW);
    digitalWrite(LED2, HIGH);
    digitalWrite(RELAY1, HIGH);
  }
}

This code says that you can add multiple cards, but im not sure how to do so.

That means you don't understand the code.

This line

  if (content.substring(1) == "59 B7 BE D4") //change here the UID of the card/cards that you want to give access

checks the card's UID. If you extend it to

  if (content.substring(1) == "59 B7 BE D4" || content.substring(1) == "A4 B9 D8 E2")

you have two cards that are allowed.

But be warned: this code is rather ugly, don't use it in a productive environment. First: the String class should not be used on AVR Arduinos (memory fragmentation). Second: the substring shouldn't be calculated twice.

Thank you for your time and example Pylon, much appreciated!