Get the current time with time.
Get a list of the files in your temp directory with glob or opendir.
Get the creation time of each file with stat.
See if the difference between now and the ctime is greater than (60 * 60 * 24 ).
If it is, delete the file with unlink.