Hey guys,
I've gotton most of my script worktin, however, there is one small problem I can not overcome.
The script is suppost to add a link to top.php whenever a file with the included file, addlink.php is iincluded. The problem is, nothing is displayed. There are no errors, but when we test the script, nothing appears where it should. If you would look over the code, we would be of much gratitued. Thanks you.
Show Links
<?PHP
$connection = mysql_connect("localhost", "a", "a") or die( mysql_error() );
mysql_select_db("a") or die( mysql_error() );
if(isset($_POST['link']) && is_array($_POST['link']))
{
foreach($_POST['link'] as $id => $checked)
{
if(!empty($checked))
{
$sql = "DELETE FROM sidekik
WHERE id = $id
LIMIT 1";
$result = mysql_query($sql);
if ($result)
{
Header("Location: {$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}");
}
}
}
}
?>
<div align="center"><font size="3" face="Verdana, Arial, Helvetica, sans-serif"><strong>S</strong>ide<strong>K</strong>ik<em><font size="1">
By <a href="http://www.22pixels.com">22Pixels</a></font></em></font> </div>
<?PHP
$ip = $_SERVER["REMOTE_ADDR"];
$sql = "SELECT *
FROM sidekik
WHERE ip = '$ip'
ORDER BY time DESC";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
print "<form action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">";
while ($row = mysql_fetch_assoc($result)) {
print "<a href=\"{$row['link']}\" target=\"sidekik\">{$row['name']}</a> <input type=\"checkbox\" name=\"link[" . $row['id'] . "]\">";
}
"</form>";
}
?><input type="submit" value="Delete" name="submit">
And The Code To Add The Links
<?PHP
$connection = mysql_connect("localhost", "a", "a") or die( mysql_error() );
mysql_select_db("a") or die( mysql_error() );
$link = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$ip = $_SERVER["REMOTE_ADDR"];
$sql =
"SELECT name FROM sidekik
WHERE ip = '$ip'";
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if ($num_rows = 0) {
$sql2 =
"INSERT INTO sidekik (ip, link, name, time)
VALUES ('$ip', '$link', '$name', NOW())";
$result2 = mysql_query($sql2);
}
?>
If you could help me out, ill be sure to mention you in the credits. Thanks a lot.