Jump to content

PHP Formula Calculation?


Padgoi

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.