Sample code done in raw PHP (no frameworks)