This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Limit number of entries variables


  1. fmolstad
    Member

    Hello.
    Would it be possible to limit the number of entries to the email address provided rather than the IP?
    Would it be possible to limit the number of entries to one per IP address per day (Then reset)?

    Forrest

    Posted 13 years ago #
  2. redityo

    This possible with some customization on "includes/post-functions.php" file. To do this, go to around line 922 for these code :

    $query = "select count(id) total_ip from ap_form_{$form_id} where ip_address='$user_ip_address'";

    then you can change the code to be like this :

    if ($form_id == 1 ){
    	$query = "select count(id) total_ip from ap_form_{$form_id} where ip_address='$user_ip_address' and date_format(date_created,'%d%m%Y') = date_format(current_date(),'%d%m%Y') ";
    }
    else if ($form_id == 2) {
    	$query = "select count(id) total_ip from ap_form_{$form_id} where element_1 = '{$table_data['element_1']}'  ";
    } else {
    	$query = "select count(id) total_ip from ap_form_{$form_id} where ip_address='$user_ip_address'";
    }

    on those code, you can see an conditional code. I assume form 1, will have limit entries by 1 ip per day. And form 2 will have limit entries based on how many submitted email address in the form ( I assume the email field id is "element_1").

    For limiting entries based on email count. You need go to line 934 for this code :

    $process_result['custom_error'] = 'Sorry, but this form is limited to one submission per user.';

    and change it to

    if ($form_id == 2) {
    	if ($row['total_ip'] == 5) {
    		$process_result['custom_error'] = 'Sorry, but the email address already submitted 5 times.';
    	}
    } else {
    	$process_result['custom_error'] = 'Sorry, but this form is limited to one submission per user.';
    }

    You need to change the id and number on those codes


    MachForm Support

    Posted 13 years ago #
  3. cyberground
    Member

    Hello.

    Would it be possible to limit the number of entries for every multiple choice?
    There is an application form with one multiple choice field for the different dates. For each choice I need something like a counter, because for each date there is only a contingent for 20 people.

    Thank you

    Posted 13 years ago #
  4. cyberground
    Member

    I found a solution for me here in your forum. Thanks a lot // I love your support and your Software.
    http://www.appnitro.com/forums/topic/checkboxes-php-disable?replies=2#post-12604 THX

    Posted 13 years ago #

RSS feed for this topic

Reply