New field in table links
- Code: Select all
`hits` mediumint(5) NOT NULL default '1'
New file in root - links.php
- Code: Select all
<?php
require_once("./admin/database.php");
$result = mysql_query("SELECT id, url, title, description, date, recip, gpr, hits FROM links WHERE id='$id' ")
or die(mysql_error());
while($row = mysql_fetch_assoc($result))
{
echo "<a href=\"out.php?id=$row[id]\">$row[title]</a>";
echo "<br>";
echo "Title: ";
echo $row[title];
echo "<br>";
echo "URL: ";
echo $row[url];
echo "<br>";
echo "Detail: ";
$textya = $row['description'];
echo $textya;
echo "<br>";
echo "Date: ";
echo $row[date];
echo "<br>";
echo "Google Page Rank: ";
echo $row[gpr];
echo "<br>";
echo "Hits Out: ";
echo $row[hits];
$link = $row[url];
}
?>
New file in root - out.php
- Code: Select all
<?php
session_start();
require_once("./admin/database.php");
$result = mysql_query("SELECT id, hits, url FROM links WHERE id='$id' ")
or die(mysql_error());
while($myrow = mysql_fetch_assoc($result))
{
$resulty = mysql_query("UPDATE links SET hits=hits+'1' WHERE id='$id'")
or die(mysql_error());
$redirect = $myrow['url'];
?>
<SCRIPT LANGUAGE="JavaScript">
redirTime = "550";
redirURL = "<?php echo $redirect ?>";
function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); }
// End -->
</script>
<BODY onLoad="redirTimer()">
<?php
}
?>
New file in root - popular.php
- Code: Select all
<?php
require_once("./admin/database.php");
$result = mysql_query("SELECT id, url, title, description, date, recip, gpr, hits, email FROM links ORDER BY hits desc LIMIT 20;")
or die(mysql_error());
while($myrow = mysql_fetch_assoc($result))
{
echo "<b><a href=\"out.php?id=$myrow[id]\"><h4>$myrow[title]</h4></a></b>";
$link = $myrow[url];
?>
<br>
<?php
echo "<br>";
echo "URL: ";
echo $myrow[url];
echo "<br>";
echo "Detail: ";
$textya = $myrow['description'];
echo = $textya;
echo "<br>";
echo "Date: ";
echo $myrow[date];
echo "<br>";
echo "Google Page Rank: ";
echo $myrow[gpr];
echo "<br>";
echo "<b>Hits Out: ";
echo $myrow[hits];
echo "</b><br>";
}
?>
and in admin/templates/body.html
- Code: Select all
{foreach from=$links item=item key=key}
<a href="/links.php?id={$item.id}"><b>{$item.title}</b></a><br>
{if $item.description <> ""}{$item.description}<br />{/if}</font>
