Registration step1 complete, step2 under work. Stamp issuing works. Now using pgsql lib instead of PDO. Still dirty version without error handling.