Hi I downloaded a add-link script that writes to a .txt file and prints on a site but the problem is it adds the link decreasingingly (as in new added link is written into the .txt file below an old one such as:
Previously added link
presviously added link
most recently added link.
How can I modify this addlink.php to write in opposite order? Thankx you in advance.
Question
WiNnErPL
Hi I downloaded a add-link script that writes to a .txt file and prints on a site but the problem is it adds the link decreasingingly (as in new added link is written into the .txt file below an old one such as:
Previously added link
presviously added link
most recently added link.
How can I modify this addlink.php to write in opposite order? Thankx you in advance.
<?php
$submit = "Add URL";
if ($action == "$submit") {
function Stripn($name)
{
$name = str_replace("'", "''", $name);
return $name;
}
function Stripd($desc)
{
$desc = str_replace("'", "''", $desc);
return $desc;
}
$name = htmlspecialchars(stripslashes(Stripn($name)));
$desc = htmlspecialchars(stripslashes(Stripd($desc)));
$link_file="./links.txt";
$write = "<li type=\"circle\"> <a href=\"$url\">$name</a> | $desc<BR>\n";
$fp=fopen($link_file, "a");
fwrite($fp, $write);
fclose($fp);
echo "<b><font size=3>$name has been added!</font><BR>Thanks for your submission.</b>";
?>
<center><BR><a href="java script:window.close()">Close Window</a></center>
<?php
}
else {
print("
Add your URL:<BR>
<FORM METHOD=POST ACTION=\"$PHP_SELF\">
Site's Title: <input type=\"TEXT\" name=\"name\" size=20><BR>
Site's URL: <input type=\"TEXT\" name=\"url\" size=20 value=\"http://\"><BR>
Site's Description: <input type=\"TEXT\" name=\"desc\" size=20 maxlength=50><BR>
<center><input type=submit name=action value=\"$submit\"></center></form>
");
}
Link to comment
Share on other sites
4 answers to this question
Recommended Posts