We had a need to keep track of when users were logging into our system. We use this data for sales, marketing and auditing the value of our site. The session logging is an extension of my previous post, Password-Protecting pages with goDaddy, PHP and mySQL server.
Create Another Table
Using the same steps as in the previous article, go into the mySQL database management page on goDaddy and create a table called logins with 3 fields in your existing database. Create the fields as follows:
Field ## Type ## Length/Values ## Collation
uid ## int ## 30
username ## varchar ## 30 ## utf8_general_ci
timestamp## varchar ## 30 ## utf8_general_ci
Switch login.php File
Once again, the login.php file is stored on this web site as a .txt file. This file has an additional 7 lines of code (including comments) from the original login.php file, starting with “#update login log”. Go To Modified login.txt
One reply on “Session Logging with PHP and mySQL”
Curtis, this system is AWESOME! Thanks man!