mattjs92
New Member
- Messages
- 4
- Reaction score
- 0
- Points
- 0
<?php
$con = mysql_connect("***","***","***") or die('Could not connect: ' . mysql_error());
$dbconnect = mysql_select_db("***", $con) or die ("could not connect to database: " . mysql_error());
if($_SESSION['username']=="***")
{
if ($_POST['title'] && $_POST['description'])
{
$check = mysql_query("INSERT INTO links (title, description) VALUES ('$_POST[title]', '$_POST[description]')") or die("Could not add content to database: " . mysql_error());
echo "<p>Link Added Successfully.</p>";
}
elseif ($_POST['title'] || $_POST['description'])
{
$title1 = $_POST['title'];
$description1 = $_POST['description'];
}
if ($_GET[successful]==1)
{
echo "<p>Link Edited Successfully.</p>";
}
echo "<form action='links.php' method='post'>
<p><b>Link Title</b><br/>
<input type='text' style='width:690px;' id='title' value='" . $title1 . "'/><br/><br/>
<b>URL: http</b><br/>
<input type='text' style='width:690px;' id='description' value='" . $description1 . "'/></p>
</form>";
$result = mysql_query("SELECT * FROM links") or die("Could not get link data: " . mysql_error());
while($row = mysql_fetch_array($result))
{
echo "<p><a href='" . $row['description'] . "'>" . $row['title'] . "</a></p><a href='edit.php?id=" . $row['id'] . "&page=links&redirect=links.php' onclick='return editEvent();'>Edit</a> | <a href='delete.php?did=" . $row['id'] . "&page=links&redirect=links.php' onclick='return doubleCheck();'>Delete</a>";
}
}
else
{
$result = mysql_query("SELECT * FROM links") or die("Invalid Query: " . mysql_error());
while($row = mysql_fetch_array($result))
{
echo "<p><a href='" . $row['description'] . "'>" . $row['title'] . "</a></p>
}
}
mysql_close($con);
?>
$con = mysql_connect("***","***","***") or die('Could not connect: ' . mysql_error());
$dbconnect = mysql_select_db("***", $con) or die ("could not connect to database: " . mysql_error());
if($_SESSION['username']=="***")
{
if ($_POST['title'] && $_POST['description'])
{
$check = mysql_query("INSERT INTO links (title, description) VALUES ('$_POST[title]', '$_POST[description]')") or die("Could not add content to database: " . mysql_error());
echo "<p>Link Added Successfully.</p>";
}
elseif ($_POST['title'] || $_POST['description'])
{
$title1 = $_POST['title'];
$description1 = $_POST['description'];
}
if ($_GET[successful]==1)
{
echo "<p>Link Edited Successfully.</p>";
}
echo "<form action='links.php' method='post'>
<p><b>Link Title</b><br/>
<input type='text' style='width:690px;' id='title' value='" . $title1 . "'/><br/><br/>
<b>URL: http</b><br/>
<input type='text' style='width:690px;' id='description' value='" . $description1 . "'/></p>
</form>";
$result = mysql_query("SELECT * FROM links") or die("Could not get link data: " . mysql_error());
while($row = mysql_fetch_array($result))
{
echo "<p><a href='" . $row['description'] . "'>" . $row['title'] . "</a></p><a href='edit.php?id=" . $row['id'] . "&page=links&redirect=links.php' onclick='return editEvent();'>Edit</a> | <a href='delete.php?did=" . $row['id'] . "&page=links&redirect=links.php' onclick='return doubleCheck();'>Delete</a>";
}
}
else
{
$result = mysql_query("SELECT * FROM links") or die("Invalid Query: " . mysql_error());
while($row = mysql_fetch_array($result))
{
echo "<p><a href='" . $row['description'] . "'>" . $row['title'] . "</a></p>
}
}
mysql_close($con);
?>
Last edited: