Code: Show/Hide <?php $valid_passwords = array ("user1" => "pass1", "user2" => "pass2"); $valid_users = array_keys($valid_passwords); $user = $_SERVER['PHP_AUTH_USER']; $pass = $_SERVER['PHP_AUTH_PW']; $validated = (in_array($user, $valid_users)) && ($pass == $valid_passwords[$user]); if (!$validated) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); die ("Authentication is required to gain access to this area. All attempts are logged."); } // If arrives here, is a valid user. echo "<p><font color=#009900>Welcome $user.</font></p>"; echo "<p><font color=#000099>You have full access to the server list.</font></p>"; $lines = file('/var/gallery/servers.txt'); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num => $line) { $line_number = $line_num + 1; echo "Server {$line_number} : " . htmlspecialchars($line) . "\n<br />"; } ?> |
Code: Show/Hide header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Description: File Transfer"); header("Content-Type: application/vnd.ms-wpl"); header("Content-Length: " . filesize($strFile)); header("Content-Disposition: attachment; filename=\"playlist.wpl\""); |
Code: Show/Hide print(file_get_contents($strFile)); |
Code: Show/Hide header("Content-...: .../..."); |
Code: Show/Hide exit; |
Code: Show/Hide echo "..."; |
Code: Show/Hide echo '...'; |