Our API provides timed protection for your websites. With the API, you can:
protect.php
file on your server with the appropriate variables.Use the API calls to verify the access code and domain, and manage the status of visitors.
<?php
$api_url = "https://lockstar.tech/API-domain.php";
$access_code = "2378fc3a99";
$domain = "YOUR_DOMAIN_NAME";
$user_ip = $_SERVER['REMOTE_ADDR'];
$post_data = http_build_query([
'access_code' => $access_code,
'domain' => $domain,
'ip_address' => $user_ip,
'ad_blocker' => isset($_POST['ad_blocker']) ? 'true' : 'false'
]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/x-www-form-urlencoded',
'Content-Length: ' . strlen($post_data)
]);
$response = curl_exec($ch);
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
curl_close($ch);
die("CURL error occurred: $error_msg");
}
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($http_code !== 200) {
error_log("HTTP status code: $http_code");
error_log("Response: $response");
die("Error occurred during API request. HTTP status code: $http_code");
}
$response_data = json_decode($response, true);
if ($response_data['status'] === 'penalty') {
header("Location: " . $response_data['redirect']);
exit();
}
$timeout_duration = isset($response_data['timeout_duration']) ? $response_data['timeout_duration'] : 25;
$formatted_valid_until = isset($response_data['valid_until']) ? date("Y-m-d H:i:s", strtotime($response_data['valid_until'])) : '';
?>
Handle responses and potential errors based on the documented status codes and messages.
The API detects if visitors are using ad blockers and handles this by blocking access.
Visitors may receive a penalty if they exceed the allowed time limit or violate other rules.
The current version of the API is v1.0. Information on updates and changes can be found here.