Php code

Hello Guys,there is this thing I want to do and I know you guys will bail me out. I need a php code that can check for stored pin(s) in my database and check if it has been used before, if No then it should proceed to the next page and assign it to a form no that it will generate and a particular account and stored it up so that no one can use the pin again except the user and for a specific number of times.
A typical example of this is found in result checking website.

I trust you guys will bail me out of this.
Best Regards

Check this sample method and see if u can implement the style.

public function createIdentity(){ global $gc; $num = rand(date("yd").time(), time()).rand(date("md").time(), time()); $identity = substr(str_replace("-","", $num), 0, 15); if(strlen($identity) < 12): return self::createIdentity(); //Re-generate else: $doQuery = $gc['db']->doQuery("SELECT ph_identity FROM ". DB__PHOTOS ." WHERE ph_identity = '".$identity."' LIMIT 1"); if($gc['db']->numRows($doQuery) > 0): return self::createIdentity(); //Re-generate else: return $identity; endif; endif; } ?>

@OLSylas, Oga mi this code bad, I have been cracking my small head to understand what u put up there can u please explain or maybe I should just give u the algorithm of what I want

The algorithm

  1. insert pin
  2. check for validity of pin
  3. if pin is not used proceed else terminate
    4.at proceed let the pin be assigned to a username or an account and be allowed access for a no of time
    5 Make the pin no possible the form no also.

This is what am lookig for my Ogas

The site is still freezing bcos I have been o n this stuff close to 15 mins b4 i could do this