K
K
KRHD2015-11-26 11:16:40
PHP
KRHD, 2015-11-26 11:16:40

How can I get a bonus for entering the site?

Is there any script that will give a bonus for each entry during the week, but so that the bonus increases depending on the day (3 days in a row = 3 rubles)
If not, how can this be done?
There is such a code, but I can only make a bonus for it for a day:

<?
require_once('config.php'); 
$bonus = 1; 

$query = mysql_query("UPDATE `users` SET `balance` = (`balance` + '$bonus') WHERE `status` = 'on'");
?>

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
MetaDone, 2015-11-26
@MetaDone

$query = mysql_query
2015 is in the yard , mysql_query will no longer be in php7.
on the issue - update the last entry date or put in cookies so that the database does not suffer. there is an input in cookies - you give bonuses, etc.

M
Michael, 2015-11-26
@scherbuk

you need to store the date of some action. for example, authorization or page updates,
as well as a bonus level, and if a certain period has not passed, then level up. if passed then reset to 0 for example
maybe there is a better solution, but I don't know it

S
Sharov Dmitry, 2015-11-26
@vlom88

you add more fields to the user
last_bonus_add - the date when the bonuses were last accrued to the user DATE
bonus format - the number of bonuses added upon entry, initially adyn, the INT format is the
logic is this, the user went to the site, we look at last_bonus_add
if this is the same day, then nothing plus
if it’s yesterday, then add balance to the bonus, and increase the bonus by as much as we want to give the user tomorrow
if more than one day has passed (the date is at least the day before yesterday), then add adyn to the balance (well, or how much you have for the first visit), and the bonus value is set in the amount of the first visit to the site.

A
Adamos, 2015-11-26
@Adamos

And is it worth doing something knee-high?
If you are interested in how users go to the site, then most likely there is an interest in statistics and analytics of visits. Screw it on, and according to this data, it will not be difficult to give bonuses whenever you want, or to conduct other promotions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question