you can use scoreboard...
there is a criteria called stat.leaveGame, you can use this to detect when the player rejoin the server, and run effect command to those players score higher or equal to 1. after that, you can set the score to be 0 and wait for the next time