diff --git a/whois/web/checkWhois.php b/whois/web/checkWhois.php
deleted file mode 100644
index 7235fc6..0000000
--- a/whois/web/checkWhois.php
+++ /dev/null
@@ -1,39 +0,0 @@
- 'Invalid request.']);
- exit;
- }
-
- if (PhraseBuilder::comparePhrases($_SESSION['captcha'], $_POST['captcha'])) {
- echo json_encode(['error' => 'Incorrect Captcha.']);
- exit;
- }
-
- $domain = $_POST['domain'];
- $whoisServer = 'whois.example.com';
-
- $output = '';
- $socket = fsockopen($whoisServer, 43, $errno, $errstr, 30);
-
- if (!$socket) {
- echo json_encode(['error' => "Error connecting to the Whois server."]);
- exit;
- }
-
- fwrite($socket, $domain . "\r\n");
- while (!feof($socket)) {
- $output .= fgets($socket);
- }
- fclose($socket);
-
- echo json_encode(['result' => nl2br(htmlspecialchars($output))]);
-
- } else {
- echo json_encode(['error' => 'Invalid request method.']);
- }
\ No newline at end of file
diff --git a/whois/web/index.php b/whois/web/index.php
index eb3b276..49f3687 100644
--- a/whois/web/index.php
+++ b/whois/web/index.php
@@ -1,61 +1,65 @@
build();
session_start();
-$_SESSION['captcha'] = $builder->getPhrase();
+use Gregwar\Captcha\CaptchaBuilder;
+
+// Include this part only if the script is requested as an image (for the captcha)
+if ($_SERVER['REQUEST_URI'] == '/captcha.php') {
+ require 'vendor/autoload.php'; // Adjust path as needed
+
+ $captcha = new CaptchaBuilder;
+ $captcha->build();
+
+ $_SESSION['captcha'] = $captcha->getPhrase();
+
+ header('Content-type: image/jpeg');
+ $captcha->output();
+ exit;
+}
?>
+
- Whois Check
-
-
-
-
+ WHOIS Lookup
+
-
Whois Check
-
-
+
WHOIS Lookup
+
+
+
+
\ No newline at end of file
diff --git a/whois/web/script.js b/whois/web/script.js
deleted file mode 100644
index 6da9ce1..0000000
--- a/whois/web/script.js
+++ /dev/null
@@ -1,31 +0,0 @@
-document.addEventListener("DOMContentLoaded", function() {
- document.getElementById("whoisForm").addEventListener("submit", function(e) {
- e.preventDefault();
-
- var xhr = new XMLHttpRequest();
- var formData = new FormData(this);
-
- xhr.open("POST", "checkWhois.php", true);
- xhr.onreadystatechange = function() {
- if (xhr.readyState === 4) {
- var resultDiv = document.getElementById("result");
- if (xhr.status === 200) {
- var data = JSON.parse(xhr.responseText);
- if (data.error) {
- resultDiv.innerHTML = '' + data.error + '
';
- } else {
- resultDiv.innerHTML = '' + data.result + '
';
- }
- } else {
- resultDiv.innerHTML = 'An error occurred. Please try again.
';
- }
- }
- };
-
- xhr.onloadstart = function() {
- document.getElementById("result").innerHTML = 'Loading...
';
- };
-
- xhr.send(formData);
- });
-});
\ No newline at end of file
diff --git a/whois/web/whois.php b/whois/web/whois.php
new file mode 100644
index 0000000..6dc6f0d
--- /dev/null
+++ b/whois/web/whois.php
@@ -0,0 +1,33 @@
+ 'Invalid request method.']);
+ exit;
+}
+
+if ($_POST['captcha'] !== $_SESSION['captcha']) {
+ die('Captcha verification failed');
+}
+
+$domain = $_POST['domain'];
+$whoisServer = 'ENTER_WHOIS_IP_HERE';
+
+$output = '';
+$socket = fsockopen($whoisServer, 43, $errno, $errstr, 30);
+
+if (!$socket) {
+ echo json_encode(['error' => "Error connecting to the Whois server."]);
+ exit;
+}
+
+fwrite($socket, $domain . "\r\n");
+while (!feof($socket)) {
+ $output .= fgets($socket);
+}
+fclose($socket);
+
+// Invalidate the current captcha
+unset($_SESSION['captcha']);
+
+echo $output;
\ No newline at end of file