Padgoi Posted June 26, 2008 Share Posted June 26, 2008 Basically I am looking for a formula to add one karma point for every day a user logs in to my forums. If the user does not log into the forums, then they don't get a karma point. I'm pretty sure there is some type of built-in function for the forums that would make this easier, but not sure. Here's what I do know: $member['stats'] = (((time() - $member['joined']) / 86400), 0); I know this code would calculate how many total days the user has been registered at the forums, but I want it so it only adds a point for when the user logs in to the forums. Any help would really be appreciated. Thanks fellas! Link to comment https://forums.phpfreaks.com/topic/111946-php-formula-calculation/ Share on other sites More sharing options...
Xyphon Posted June 26, 2008 Share Posted June 26, 2008 Well.. You could do something like this.. Let's say you named the login submit button to login. first, add a column in the database called karmaday, if its no logging in adds karma if its yes it doesnt. if(isset(['Login'])) { $Karma + 1 (not the actuall formula, but you should get what I mean) mysql_query("UPDATE forums SET Karmaday='Yes' WHERE Username='$Username'"); And then make it, so every 24 hours, Karmaday is set to no. Link to comment https://forums.phpfreaks.com/topic/111946-php-formula-calculation/#findComment-574565 Share on other sites More sharing options...
Padgoi Posted June 26, 2008 Author Share Posted June 26, 2008 Thanks Xyphon, but is there any way you could be a bit more specific? My PHP skills are quite lacking. Link to comment https://forums.phpfreaks.com/topic/111946-php-formula-calculation/#findComment-574592 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.