You are right!@Richard G, But can you unblock a IP on user level with the script from Poralix? I think what @urgido want is for the user to be able to unblock a IP, because admin can already unblock a IP directly using CSF.
The UnBlockIP WHMCS module from https://www.serverping.net/clients/cart.php?gid=3 is free and open source under the BSD. It works on both cPanel and DirectAdmin. So maybe you could use the source code to that module and change it to work with CodeIgniter?
Ok but then you should have been more clear with your question.This post and replies are misunderstanding my requirement.
how is possible unblock an ip blocked by csf through directadmin?
<!doctype html>
<html class="vue-app">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8;">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>158.x.x.x - DirectAdmin v1.59.1</title>
<link rel="shortcut icon" href="/images/favicon.png" type="image/x-icon" />
<link href="/assets/css/app.css?ver=f2495d24f15b41652e3604215b518b3befa7f12e" type="text/css" rel="stylesheet"/>
</head>
<body class="preloader">
<div id="root" v-cloak>
<App>
<app-plugin-page slot="page:content" />
</App>
</div>
<!-- Foot scripts -->
<div id="foot" style="display: none">
<script type="text/javascript" src="/assets/preloader.js?ver=f2495d24f15b41652e3604215b518b3befa7f12e"></script>
<script type="text/javascript" src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default-3.4,NodeList.prototype.@@iterator,Array.prototype.find,Array.prototype.findIndex,Array.prototype.includes"></script>
<script type="text/javascript" src="/assets/vendors.js?ver=f2495d24f15b41652e3604215b518b3befa7f12e"></script>
<script type="text/javascript" src="/assets/app.js?ver=f2495d24f15b41652e3604215b518b3befa7f12e"></script>
</div>
</body>
</html>
On what page the IP is shown as not blocked? On what page do you try to unblock it?
On what page the IP is shown as not blocked? On what page do you try to unblock it?
<!doctype html>
<html class="vue-app">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8;">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>158.69.118.43 - DirectAdmin v1.59.4</title>
<link rel="shortcut icon" href="/images/favicon.png" type="image/x-icon" />
<link href="/assets/css/app.css?ver=266961f4264cf1d965046fc4d471bdef5f4989e3" type="text/css" rel="stylesheet"/>
</head>
<body class="preloader">
<div id="root" v-cloak>
<App>
<app-plugin-page slot="page:content" />
</App>
</div>
<!-- Foot scripts -->
<div id="foot" style="display: none">
<script type="text/javascript" src="/assets/preloader.js?ver=266961f4264cf1d965046fc4d471bdef5f4989e3"></script>
<script type="text/javascript" src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default-3.4,NodeList.prototype.@@iterator,Array.prototype.find,Array.prototype.findIndex,Array.prototype.includes"></script>
<script type="text/javascript" src="/assets/vendors.js?ver=266961f4264cf1d965046fc4d471bdef5f4989e3"></script>
<script type="text/javascript" src="/assets/app.js?ver=266961f4264cf1d965046fc4d471bdef5f4989e3"></script>
</div>
</body>
</html>
And this is the code:HTTP/2 200
content-type: text/html
server: DirectAdmin Daemon
vary: Accept-Encoding
x-frame-options: sameorigin
date: Sat, 09 Oct 2021 10:33:25 GMT
The request was made without a referer header and will not be immediately followed.
function getlog($ip,$username,$password,$cliente_ip) {
$url = 'https://'.$ip.':2222';
// set temp cookie
$ckfile = tempnam ("/tmp", "CURLCOOKIE");
// make list of POST fields
$fields = array(
'referer' =>'/',
'username'=>$username,
'password'=>$password
);
$ch = curl_init();
curl_setopt($ch,CURLOPT_COOKIEJAR, $ckfile);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_URL,$url.'/CMD_LOGIN');
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($fields));
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch,CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_VERBOSE, 1);
curl_setopt($ch,CURLOPT_COOKIESESSION, true);
curl_setopt($ch,CURLOPT_COOKIE, "CURLCOOKIE");
$result = curl_exec($ch);
if($result===false) {
die('CURL ERROR: '.curl_error($ch));
} else {
curl_setopt($ch,CURLOPT_URL,$url.'/CMD_PLUGINS_ADMIN/csf/index.raw');
curl_setopt($ch,CURLOPT_COOKIEFILE, $ckfile);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"action=kill&ip=$cliente_ip");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$result = curl_exec($ch);
curl_close($ch);
if($result===false) {
die('CURL ERROR: '.curl_error($ch));
} else {
return $result;
}
}
}