PDA

View Full Version : [MOD]Limit the number of Free (nofollow) Submissions/ day/ Month - Dir.vc (msolution)


msolution
04-22-2008, 09:03 PM
Mod Title: Limit the number of Free (nofollow) Submissions/ day

Last Updated: 2007-09-24

Supported by Mod Developer: Yes

Where to Download: http://www.dir.vc/free-phpld-mods/

Support Via This Thread or Download Site: This Thread

Compatible With: phpLD 2.1.2, phpLD 3.x



This Mod allows you to Limit the number of Free (nofollow) Submissions in a day! Putting tab on the Pending Queue!

itsagaz
04-26-2008, 10:39 PM
Hi,
This is just what I have been looking for.
I have just downloaded this and you say it is tested on v3.2 but will it also function on v3.3.x ? I would like to know before I start to implement this.
Thanks
www.directorysnap.com

diehard
05-10-2008, 10:33 PM
Hello, How do I edit the code to allow 50 Free links per day? Ive tried playing with it, to no avail. ANy help is great.


require_once 'init.php';

$free_submit_date = date("Y-m-d", time());
$free_submit_date2 = date("Y-m-d", mktime(0,0,0,date("m"), date("d")+1, date("Y")));

$disable_free = '';
$disable_free_text = '';
$monthly_limit_reached = false;

/*
$limit_what = "";

1. " `NOFOLLOW` = '1' "; // THIS WILL LIMIT ONLY NOFOLLOW LINKS
2. " `PAYED` = '-1' "; // THIS WILL LIMIT ALL FREE, WHETHER YOU HAVE REGULAR FREE/ RECIPROCAL FREE/ NOFOLLOW FREE
*/

$limit_what = " `NOFOLLOW` = '1' ";

//install the mod if not installed//
// ---------------------------------
if(!defined ('_FREE_SUBMISSIONS_DATE'))
$rs = $db->Execute("INSERT INTO `{$tables['config']['name']}` SET `ID`='_FREE_SUBMISSIONS_DATE', `VALUE`='".$free_submit_date."'");

if(!defined ('_FREE_SUBMISSIONS_LIMIT'))
$rs = $db->Execute("INSERT INTO `{$tables['config']['name']}` SET `ID`='_FREE_SUBMISSIONS_LIMIT', `VALUE`='5'");

if(!defined ('_FREE_SUBMISSIONS_MONTH_LIMIT'))
$rs = $db->Execute("INSERT INTO `{$tables['config']['name']}` SET `ID`='_FREE_SUBMISSIONS_MONTH_LIMIT', `VALUE`='99'");
// ---------------------------------


// if it is not disabled//
if (defined ('_FREE_SUBMISSIONS_MONTH_LIMIT') && _FREE_SUBMISSIONS_MONTH_LIMIT != 0){
// free submissions this month//
$this_month_start = date("Y-m-d", mktime(0,0,0,date("m"), 1, date("Y")));
$this_month_end = date("Y-m-d", mktime(0,0,0,date("m")+1, 1, date("Y")));
$this_month_where = " `DATE_ADDED` between '".$this_month_start."' and '".$this_month_end."' ";
$FREE_SUBMISSIONS_MONTH = $db->GetOne("SELECT COUNT(*) FROM `{$tables['link']['name']}` WHERE ".$this_month_where." AND {$limit_what}");

if($FREE_SUBMISSIONS_MONTH > _FREE_SUBMISSIONS_MONTH_LIMIT ){

// disable the radio button as limit has been reached//
$disable_free = ' disabled="disabled" ';
$disable_free_text = '<br /><font size="1">Free listings are restricted to '._FREE_SUBMISSIONS_MONTH_LIMIT.' per <b>month</b>,<br /><b>Feel free to choose other types of listings, or check back tomorrow! :)</b></font>';
$monthly_limit_reached = true;
}
}

//free submissions today!//
// if it is not disabled, and monthly limit has not been reached! //
if ( defined ('_FREE_SUBMISSIONS_LIMIT') && _FREE_SUBMISSIONS_LIMIT != 0 && !$monthly_limit_reached ) {

if( $free_submit_date == strtotime(_FREE_SUBMISSIONS_DATE) ) {

// its a new day, update the date//
$db->Execute("UPDATE `{$tables['config']['name']}` SET `VALUE` = '".$free_submit_date2."' WHERE `ID` = '_FREE_SUBMISSIONS_DATE'");

} else {

// free submissions today//
$FREE_SUBMISSIONS_TODAY = $db->GetOne("SELECT COUNT(*) FROM `{$tables['link']['name']}` WHERE `DATE_ADDED` >= CURRENT_DATE AND {$limit_what}");
if($FREE_SUBMISSIONS_TODAY >= _FREE_SUBMISSIONS_LIMIT ){

// disable the radio button as limit has been reached//
$disable_free = ' disabled="disabled" ';
$disable_free_text = '<br /><font size="1">Free listings are restricted to '._FREE_SUBMISSIONS_LIMIT.' per day<br /><b>Feel free to choose other types of listings, or check back tomorrow! :)</b></font>';
}
}
}
$tpl->assign('disable_free', $disable_free);
$tpl->assign('disable_free_text', $disable_free_text);

msolution
05-11-2008, 09:57 PM
that would be in the admin panel, please goto settings