How to control a payment plan period [closed]

Suppose a user create an account today the 22 of April on my website and I have set the period to 30days how can i get a code that will automatically block the user from the dashboard when they try to login after their 30days payment is expired. Instead, upon login they should be redirected to a update payment page till they renew their payment before they will have access to the dashboard again

I tried using php to count and compare the date of login with the sign up date stored in the DB but now I faced problems with the redirection because I didn’t know how to redirect the user automatically to the update payment page and also back to the dashboard after payment is been updated