rfid was not declared on this scope

I guess you just found that code somewhere but you don't understand it at all.

The reason you have an error saying "rfid was not declared on this scope" is because you have not declared anything called "rfid" in the code. You have declared an MFRC522 object for the RFID reader but it is named "rif" not "rfid". Try changing "rif" to "rfid".

Steve