You could generate a pin like this:
There is a small possibility of duplicate entries but if the PIN is used one then reset, that shouldn't be an issue.
//Number of PINs to make
$x = 15;
$pin = substr(sha1(microtime()),-5);