Hey guys,
Don't know if you've heard. But i'm develpoing a web based toolbar called sidekik. http://sidekik.22pixels.com (Quicklaunch is all that works sofar). If you play around a little, you'll notice that your only able to have one link displayed at a time. I would like the link to be displayed once, but have multiple unique links at the same time. So only one instance of a link with the same name, but links with different names could be displayed aswell. Here are the two php files. The first one adds the link, the second shows it.
Addlink.php
<?php
error_reporting( E_ALL );// Turns all reports ON
$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);
}
?>
Showlink.php
<?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: [url]http://22pixels.com/SideKik/Installed.php[/url]");
}
}
}
}
?>
<div align="center">
<p><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Select Then Hit
The Delete Button<br>
<?PHP
$ip = $_SERVER["REMOTE_ADDR"];
$sql = "SELECT *
FROM sidekik
WHERE ip = '$ip'
ORDER BY time DESC";
$result = mysql_query($sql);
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'] . "]\"><BR>";
}
?>
<br>
<input type="submit" value="Delete Selected" name="submit"></form>
</font></p>
</div>
Thanks For The Help. Name Will Be Mentioned In Credits.