If I have understand what you want to do, I think that the best (and easy) way is to use a Database where save data.
MySQL is a good one.
May be you have to get rid of some SQL and MySQL commands (or commands of the database you are going to use).
You can also do the same with files and arrays but it seems more hard for me.
Fabio