Created
May 10, 2022 04:12
-
-
Save banasiak/d74743bf7e382ae50dedeaf96a3d6c16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Deeplink Test</title> | |
</head> | |
<body> | |
<h3>Enter Link URL</h3> | |
<form action="links.php" method="post"> | |
<input name="deeplink" value="https://"/> | |
<input type="submit" value="Submit"/> | |
</form> | |
<?php | |
$file = fopen("links.txt", "a+"); | |
if ($_SERVER['REQUEST_METHOD'] === 'POST') { | |
$link = $_POST['deeplink']; | |
if (isset($link) && $link !== "https://") { | |
echo "<h3>Your Link</h3>"; | |
echo "<ul><li><a href=\"$link\">$link</a></li></ul>"; | |
fwrite($file, "$link\n"); | |
} | |
} | |
?> | |
<h3>Other Links</h3> | |
<ul> | |
<?php | |
rewind($file); | |
while (($line = fgets($file)) !== false) { | |
echo "<li><a href=\"$line\">$line</a></li>"; | |
} | |
fclose($file); | |
?> | |
</ul> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment