<?php function validation_generate_code($dbconn,$uservalue) { $vc_seed=mt_rand(); $vc_code=$uservalue^$vc_seed; $vc_id=db_insert_validation_code($dbconn,$vc_code); return array('vc_id'=>$vc_id,'vc_seed'=>$vc_seed); } function validation_use_code($dbconn,$vc_id,$uservalue,$vc_seed) { $vc_code=$uservalue^$vc_seed; return db_delete_validation_code($dbconn,$vc_id,$vc_code)>0; } ?>