One programmer wrote this add-on for me, but it has an issue. The programmer is currently busy with a lot of work, so I was wondering if someone can help me with it.
The add-on should allow people to post a set amount of free ads and once that limit is reached they are required to post featured (paid) ads.
This is what goes to the config file:
// Max amount of free ads user can post. If set at 0 it only allows featured listings. Default is 10
$free_ad_limit = 10;
// Enable the timer so that if a certain amount of time is passed, poster can post ads again. Enabled: 1
$enable_max_ad_timer = 1;
// If $enable_max_ad_timer is enabled above, specify how much time poster has until their free ad limit expires. Default: 86400 (24 hours)
$max_free_ad_expire = 86400;
And this is what goes to the post file:
What happens is it stops people from posting free ads just fine, but then when the $max_free_ad_expire expires it continues to stop free ads from being posted. It's supposed to let them be posted again after 24 hours (or whatever time frame I want to use).
if ($enable_max_ad_timer == 1)
$ask_query = "SELECT ip FROM $t_ads
WHERE ip = '$_SERVER[REMOTE_ADDR]'
AND (UNIX_TIMESTAMP(createdon) > '1379843684'
AND UNIX_TIMESTAMP(createdon) <= '".(time()+$max_free_ad_expire)."')";
$ask_result = mysql_query($ask_query);
$ask_count = mysql_num_rows($ask_result);
if ($_POST['promote']['featured'] == 0 && $ask_count >= $free_ad_limit)
$err .= "• $lang[ERROR_ASK_FEATURED]<br>";
Does anyone know what the issue might be?