Description

This function enables leech protection on a directory.

Examples




$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$enable_leech = $cpanel->api1('LeechProtect','enable', array('/home/username/public_html/protected_directory/','100','http://elsewhere.example.com/','user@example.com','0') ); // Call the function.

 



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $enable_leech = $cpliveapi->api1('LeechProtect', 'enable', ['/home/username/public_html/protected_directory/','100','http://elsewhere.example.com/','user@example.com','0']); # Call the function.

 


<cpanel Module="LeechProtect::enable ( $FORM('dir','numhits','badurl','email',killcompro'))">




cpapi1 --user=username LeechProtect enable /home/username/public_html/protected_directory/ 100 http://elsewhere.example.com/ user@example.com 0



LeechProtection enabled for public_html/protected_directory




Parameters

ParameterTypeDescriptionPossible valuesExample
dirstring

Required

The directory's path.

A valid full file path.
/home/username/public_html/protected_directory/
numhitsinteger

The number of times that a user can log in to a resource before leech protection triggers.

This parameter defaults to 4 .

A positive integer.

100
badurlstring

Required

A URL to redirect visitors to when leech protection triggers.

A valid URL that exists.http://elsewhere.example.com/
emailstringAn email address to alert when leech protection triggers.A valid email address.user@example.com
killcomprostringWhether to disable the account that triggers leech protection.
  • 1 — Disable.
  • 0 — Do not disable.
0

Returns

This function returns a confirmation message.