I'm currently in the process of writing a little blog / generic posting system using CGI in C as a hobby project and am now in the need of a session management system to authentificate authorized users for posting, editing and similar operations over multiple CGI programs
From working with PHP years ago I remember using the superglobal variable $_SESSION
and some session intializing functions. Obviously this is not going to work this way when dealing with pure CGI, so I'm in a tricky situation here.
A bit of thinking showed that there's many different ways to do such a thing...
- Saving the IP address and attributes inside a file where I can see if a particular IP is authorized
- Same as #1 but using an SQLite database (my engine already runs on SQLite so there would be no additional overhead)
- Something with cookies maybe?
Instead of going all in and regret is later... what do you good people think? What's the most efficient (and most importantly) and the maintainable method?
Please note that I do not want to get a third party libary to do all the complicated things for me! I started this project to build something completely by myself (if you ignore SQLite here) and I don't want to hide the hard parts, even if it makes everything so much simpler. I could have just used Python if I didn't want to torture myself :)