Test Connection Php Script (last one got unlisted?)
InfinityFree Forum [Unofficial]
March 6, 2026
Here a free PHP code:
<?php
$correct_password = "1234";
$cookie_value = md5($correct_password . "YourSaltHere");
$template_name = "TestConnectionPhp[NUMBER]";
$is_auth = false;
$active_cookie_name = "";
foreach ($_COOKIE as $name => $value) {
if ($value === $cookie_value) {
$is_auth = true;
$active_cookie_name = $name;
break;
}
}
if (isset($_POST['access_pw'])) {
if ($_POST['access_pw'] === $correct_password) {
$random_digit = mt_rand(100000, 999999);
$final_name = str_replace("[NUMBER]", $random_digit, $template_name);
setcookie($final_name, $cookie_value, time() + (86400 * 30), "/");
header("Location: " . $_SERVER['PHP_SELF']);
exit;
} else {
echo "<b>WRONG PASSWORD NOOB!</b><br>";
}
}
if (isset($_GET['logout'])) {
if ($active_cookie_name !== "") {
setcookie($active_cookie_name, "", time() - 3600, "/");
}
header("Location: " . $_SERVER['PHP_SELF']);
exit;
}
if (!$is_auth) {
echo "<h1>LOGIN</h1>";
echo "<form method='POST'>";
echo "Password: <input type='password' name='access_pw' autofocus> ";
echo "<input type='submit' value='UNLOCK'>";
echo "</form>";
exit;
}
error_reporting(E_ALL);
ini_set('display_errors', 1);
if (function_exists('session_start')) {
@session_start();
if (!isset($_SESSION['test_hit'])) {
$_SESSION['test_hit'] = 1;
} else {
$_SESSION['test_hit']++;
}
}
function getClientIP() {
$ip_headers = ['HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_REAL_IP', 'REMOTE_ADDR'];
foreach ($ip_headers as $header) {
if (!empty($_SERVER[$header])) {
$parts = explode(',', $_SERVER[$header]);
return trim($parts[0]);
}
}
return 'Unknown';
}
$publicServerIP = gethostbyname($_SERVER['SERVER_NAME']);
$startTime = microtime(true);
echo "<a href='?logout=1'>[Logout]</a>";
echo "<h1>Ultimate Connectivity & Server Audit</h1>";
echo "<p>Auth Cookie Found: <b>" . htmlspecialchars($active_cookie_name) . "</b></p>";
echo "<h3>Network Identity</h3>";
echo "<ul>";
echo "<li><strong>Detected Client IP:</strong> " . getClientIP() . "</li>";
echo "<li><strong>Proxy/Gateway IP (REMOTE_ADDR):</strong> " . $_SERVER['REMOTE_ADDR'] . "</li>";
echo "<li><strong>Internal Server IP:</strong> " . ($_SERVER['SERVER_ADDR'] ?? 'N/A') . "</li>";
echo "<li><strong>Resolved Public Server IP:</strong> " . $publicServerIP . "</li>";
echo "<li><strong>Reverse DNS (Host):</strong> " . (function_exists('gethostbyaddr') ? @gethostbyaddr($_SERVER['REMOTE_ADDR']) : 'Disabled') . "</li>";
echo "</ul>";
echo "<h3>Environment Details</h3>";
echo "<ul>";
echo "<li><strong>Host Name:</strong> " . $_SERVER['HTTP_HOST'] . "</li>";
echo "<li><strong>Server Port:</strong> " . $_SERVER['SERVER_PORT'] . "</li>";
echo "<li><strong>Server Software:</strong> " . $_SERVER['SERVER_SOFTWARE'] . "</li>";
echo "<li><strong>PHP Version:</strong> " . PHP_VERSION . "</li>";
echo "<li><strong>HTTPS Status:</strong> " . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'Active' : 'Inactive') . "</li>";
echo "<li><strong>Session Persistence:</strong> " . (isset($_SESSION['test_hit']) && $_SESSION['test_hit'] > 1 ? 'Working (Hits: '.$_SESSION['test_hit'].')' : 'New Session (Refresh to test)') . "</li>";
echo "</ul>";
echo "<h3>System Resources</h3>";
echo "<ul>";
if (function_exists('disk_total_space') && function_exists('disk_free_space')) {
$freeSpace = @disk_free_space(".");
$totalSpace = @disk_total_space(".");
echo "<li><strong>Disk Usage:</strong> " . round(($totalSpace - $freeSpace) / (1024 * 1024 * 1024), 2) . " GB / " . round($totalSpace / (1024 * 1024 * 1024), 2) . " GB</li>";
}
if (function_exists('sys_getloadavg')) {
$load = sys_getloadavg();
echo "<li><strong>CPU Load (1/5/15 min):</strong> " . $load[0] . ", " . $load[1] . ", " . $load[2] . "</li>";
}
echo "<li><strong>Memory Limit:</strong> " . ini_get('memory_limit') . "</li>";
echo "<li><strong>Max Execution Time:</strong> " . ini_get('max_execution_time') . "s</li>";
echo "<li><strong>Script Execution Time:</strong> " . round((microtime(true) - $startTime) * 1000, 2) . " ms</li>";
echo "</ul>";
echo "<h3>Active Session Cookies</h3>";
echo "<ul>";
if (!empty($_COOKIE)) {
foreach ($_COOKIE as $name => $value) {
echo "<li><strong>" . htmlspecialchars($name) . ":</strong> " . htmlspecialchars($value) . "</li>";
}
} else {
echo "<li>No cookies found.</li>";
}
echo "</ul>";
echo "<h3>Common Port Availability</h3>";
echo "<ul>";
if (function_exists('fsockopen')) {
$ports = ['HTTP' => 80, 'HTTPS' => 443, 'FTP' => 21, 'SSH' => 22, 'MySQL' => 3306];
foreach ($ports as $name => $port) {
$connection = @fsockopen('127.0.0.1', $port, $errno, $errstr, 0.1);
$status = $connection ? '<span style="color:green">Open</span>' : '<span style="color:red">Closed/Filtered</span>';
echo "<li><strong>Port $port ($name):</strong> $status</li>";
if ($connection) fclose($connection);
}
}
echo "</ul>";
echo "<h3>Full Header Trace</h3>";
echo "<pre style='background:#f4f4f4; padding:10px; border:1px solid #ccc; overflow:auto;'>";
if (function_exists('getallheaders')) {
foreach (getallheaders() as $name => $value) {
echo htmlspecialchars("$name: $value\n");
}
} else {
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
echo htmlspecialchars(str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5))))) . ": $value\n");
}
}
}
echo "</pre>";
echo "<p><small>Generated at: " . date("Y-m-d H:i:s T") . "</small></p>";
?>
See it running at gavincodework.qzz.io/Test.php (If you get ask for a password it will be 1234 unlet you edited the code)
Discussion in the ATmosphere