Cory94bailly Posted May 9, 2008 Share Posted May 9, 2008 How can I log actions? Like who logs in/who logs out, who added/deleted what news? And then, how would I get it to (of course) same to mysql and display it in a php file? Quote Link to comment Share on other sites More sharing options...
Spaceman-Spiff Posted May 9, 2008 Share Posted May 9, 2008 You should learn some basic PHP & MySQL if you want to do something like this. http://www.google.com/search?q=php+tutorials Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted May 9, 2008 Author Share Posted May 9, 2008 You should learn some basic PHP & MySQL if you want to do something like this. http://www.google.com/search?q=php+tutorials I know basic php and a bit of mysql.. I just don't know how to log the actions..! Quote Link to comment Share on other sites More sharing options...
Spaceman-Spiff Posted May 9, 2008 Share Posted May 9, 2008 It all depends on how the program/script works... For example, for this forum (SMF), you can record the actions by the "action" in the url (get method). Like: action=post, action=register, and so on... Different program works differently, I can't tell you how to do something I don't know about... Quote Link to comment Share on other sites More sharing options...
NorthWestSimulations Posted May 9, 2008 Share Posted May 9, 2008 get it so that on every page there is a <?php $pagename = basename($_SERVER['PHP_SELF']); date_default_timezone_set('UTC'); $time = date(); ?> And get the script to insert that data into a mySQL database when the page loads. You can also have it log usernames, id's and other things too if you declare variables for them. Although this type of logging system will be hard on a high traffic website as there will be way too many MySQL Query's being performed per second Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted May 9, 2008 Author Share Posted May 9, 2008 get it so that on every page there is a <?php $pagename = basename($_SERVER['PHP_SELF']); date_default_timezone_set('UTC'); $time = date(); ?> And get the script to insert that data into a mySQL database when the page loads. You can also have it log usernames, id's and other things too if you declare variables for them. Although this type of logging system will be hard on a high traffic website as there will be way too many MySQL Query's being performed per second Fatal error: Call to undefined function: date_default_timezone_set() in /home/content/m/a/r/markbailly/html/test69.php on line 3 Quote Link to comment Share on other sites More sharing options...
NorthWestSimulations Posted May 9, 2008 Share Posted May 9, 2008 ?? What? that is okward. Works fine for my server. Do you happen to know what version of PHP your using. Type this syntax phpinfo(); Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted May 9, 2008 Author Share Posted May 9, 2008 ?? What? that is okward. Works fine for my server. Do you happen to know what version of PHP your using. Type this syntax phpinfo(); 4.3.11 I don't know how to get it updated.. I am with godaddy. Quote Link to comment Share on other sites More sharing options...
NorthWestSimulations Posted May 9, 2008 Share Posted May 9, 2008 Theres your problem this function only started in PHP 5.1.0 or above. Just remove this function from the code, itll still og it but only using the servers time. Not a UTC Timestamp Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted May 9, 2008 Author Share Posted May 9, 2008 Although this type of logging system will be hard on a high traffic website as there will be way too many MySQL Query's being performed per second What is the best way to log actions? Quote Link to comment Share on other sites More sharing options...
NorthWestSimulations Posted May 9, 2008 Share Posted May 9, 2008 Although this type of logging system will be hard on a high traffic website as there will be way too many MySQL Query's being performed per second What is the best way to log actions? using PHP and MySQL but only on low traffic websites. If you have a high traffic website then a larger bandwidth would have to be required Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted May 10, 2008 Author Share Posted May 10, 2008 get it so that on every page there is a <?php $pagename = basename($_SERVER['PHP_SELF']); date_default_timezone_set('UTC'); $time = date(); ?> And get the script to insert that data into a mySQL database when the page loads. You can also have it log usernames, id's and other things too if you declare variables for them. Although this type of logging system will be hard on a high traffic website as there will be way too many MySQL Query's being performed per second Ok I did that.. I contacted my host, upgraded to php5 and now I get this: Warning: date() expects at least 1 parameter, 0 given in /home/content/m/a/r/markbailly/html/test69.php on line 4 Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 10, 2008 Share Posted May 10, 2008 $time = date("F j, Y, g:i a"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.