samedi 22 février 2020

Why does if statement cause http error 500 [duplicate]

Trying to create a login and register system. To complete the registration the user has to click on a link sent to its email and valid for 15 minutes. When clicking on the link the user is taken to a site that is meant to check if the link still was valid when clicked on. To do this i save the register time in a database with the now() method when the user is signing up. When checking if the link is valid i save the register time in to another variable. From there i chop the string(register time string) with substr so i now have year, month, day, hour and minute saved in different variables. Then i save the year, month, day, hour, minute at the moment when the link was clicked with the date() method into other variables. Now i have to compare all the numbers but i encountered a problem that i have been trying to solve for two days now and still cant figure out a solution. To check if it is a month with 31 days in it i use this code:

if ($month_now == 01 || $month_now == 03 || $month_now == 05 || $month_now == 07 || $month_now == 08 || $month_now == 10 || $month_now == 12)

and then

else if ($month_now == 04 || $month_now == 06 || $month_now == 09 || $month_now == 11) 

but for some reason when i load up the site, the site doesnt load up and i get the HTTP ERROR 500. If the if statement looks like this:

if ($month_now == 01)

I dont get the error and the site load up properly. So my question is, how do i solve this?

Aucun commentaire:

Enregistrer un commentaire