Store some sort of flag in the database for that user so the script will know that they must change their password. When a user requests a new password set it to 1. Once they update their password set it to 0. Without knowing more about your db structure it's hard to say exactly how you should create the flag (ie as a new column in the user table, as meta data, etc).
Normally, wouldn't such a script just generate a random string for the password, send it to the user, and then let the user reset it on their own if they choose to. Why do you want to force users to set a new password immediately?
Last edited by NullPointer; 01-03-2012 at 11:34 PM..