I am trying to make something similar to http://www.yellow5.com/magic/magicurl.php . I have a page called index.html with the following:
<table>
<tr>
<td>
<FORM METHOD=GET ACTION="submit.php">
Your URL:
<INPUT NAME="url" TYPE="TEXT" value="http://" size="50" maxlength="100">
</td>
<td align="left" valign="top">
<input type="submit" name="submit" value="SPAM!">
</td>
</tr>
</table>
and then a file called submit.php...
<?
if ($url != "") {
$url = htmlspecialchars("$url", ENT_QUOTES);
$filename = 'list.txt';
$fp = fopen($filename, "a");
$string = $url . "\n";
$write = fputs($fp, $url . "<br>");
fclose($fp);
echo ($url . " written to the file");
}
?>
</b>
<hr>
<?
include("list.txt");
?>
Well in my case the value "$url" needs to have HTML in it to make it in "a href" (link) but when I have "htmlspecialchars" assigned to the variable it only shows up as HTML code, sure I could get it to work without the 'htmlspecialchars' but then it allows people to change text size, parse PHP, etc...
So this one question needs to be answered: How do you only let links be parsed but no other HTML.