<?php error_reporting(0);
require("head.php");?>
<center>
<h5>Add a Link</h5>
<form action="showchangelinks.php" method="post">
<p>Link Name:</p>
<p><input type="text" name="aname" /></p>
<p>Link Address:</p>
<p><input type="text" name="address" /></p>
<p>Order Number:</p>
<p><input type="text" name="orderby" /><br>
(The lower the number the higher it will appear in the list)</p>
<p><input type="submit" value="Add link!" /></p>
</form>
<h5>Delete a Link</h5>
<form action="showchangelinks.php" method="post">
<p>Link Name:</p>
<p><input type="text" name="dname" /></p>
<p><input type="submit" value="Delete link!" /></p>
</form>
</center>
<?php require("config.php");
echo "<center>";
if(isset($_POST['aname']) && isset($_POST['address']) && isset($_POST['orderby']))
{
$aname = clean_string($_POST['aname']);
$address = clean_string($_POST['address']);
$orderby = clean_string($_POST['orderby']);
if ($_POST['orderby'] == "")
{
echo "Please fill in all the fields.";
} else {
//Insert new Faction Info post
mysql_query("INSERT INTO links (Name, Address, OrderBy)
VALUES ('" . $aname . "','" . $address . "','" . $orderby . "')") or die(mysql_error());
echo "Link sucessfully added!";
}
}
if(isset($_POST['dname']))
{
$dname = clean_string($_POST['dname']);
if ($_POST['dname'] == "")
{
echo "Please fill in the field.";
} else {
//Insert new Faction Info post
mysql_query("DELETE FROM links
WHERE Name='$dname'");
echo "Link sucessfully deleted!";
}
}
echo "</center>";
mysql_close($connect);
?>