Child pages
  • cPanel API 1 Functions - DenyIp::adddenyip

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function adds a deny from IP line to the account's .htaccess file.

Include Page
LIB:_cPanelAPI1NoEquivalent
LIB:_cPanelAPI1NoEquivalent

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledWebServerRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples 


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$deny_ip = $cpanel->api1('DenyIp', 'adddenyip', array('192.168.0.1','0') ); // Call the function.

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $deny_ip = $cpliveapi->api1('DenyIp', 'adddenyip', ['192.168.0.1','0'] ); # Call the function.

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink

 


Expand
titlecPanel Tag System (deprecated)

Include Page
LIB:_cPanelTagsWarning
LIB:_cPanelTagsWarning

Code Block
languagetext
<cpanel Module="DenyIp::adddenyip( $FORM('ip','quiet') )">



Expand
titleCommand Line


Code Block
languagebash
cpapi1 --user=username DenyIp adddenyip 192.168.0.1 0

Include Page
LIB:_cPanelAPI1CLINote
LIB:_cPanelAPI1CLINote


Expand
titleOutput (plaintext)


Code Block
languagexml
Users from the IP address(s) 192.168.0.1 will not be able to access your site.

   




Parameters

ParameterTypeDescriptionPossible valuesExample
ip

string

Required

The IP address or addresses to deny.

A single IP address, or a range of addresses as follows:

ExampleDescription

192.168.0.1

Single IP Address

192.168.0.1-192.168.0.58

Range

192.168.0.1-58

Implied Range

192.168.0.1/16

CIDR Format, which matches 192.168.*.*
10.Matches 10.*.*.*


192.168.0.1

 

quietBooleanWhether to suppress error messages.
  • 1 — Hide error messages.
  • 0 — Display error messages.
0

Returns

  • If it succeeded, the function returns a message of success.
  • If it failed, this function returns any errors, unless you set the quiet parameter to 1.