Well, if you are going to be storing user passwords in a table, just add a column to that table to store the date last changed (when a user changes their password, update the table with the current date (now function).
Then, when they login each time, check the login table for the date...if it is older than 30 days old, prompt for change.