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