Redirecting after count? ( PHP & DB Type Question)
Posted: Wed Mar 10, 2004 9:59 pm
OK, im doing a link tracker script for myself that counts how every many times someone clicks on a link (clinks.php?id=2). I know how to get the number in the database to increase "1" everytime this happends, but what i want to know is how do i get it to actually goto that site?
Example:
Database Entry:
ID: 1
Site URL: http://www.d-frame.co.uk
Count: 0
When a link is clicked (example: clicks.php?id=1) it goes to http://www.d-frame.co.uk, but i only know how to do that with a frame type thing, because i have the top frame window holding the count script and the bottom table window as the table that actually views the site. So what i want to know is how do i get it so when i click the link it sends them to the site that they clicked for but still it counts it in the database without any frames being involved?
Here is an example of the code i have:
index.php
clicks.php
count.php
I hope you followed... my english is poor, considering i was born english and have been in england for the whole of my 16 and a half-ish years...
(PS; Sorry if in wrong room!)
Example:
Database Entry:
ID: 1
Site URL: http://www.d-frame.co.uk
Count: 0
When a link is clicked (example: clicks.php?id=1) it goes to http://www.d-frame.co.uk, but i only know how to do that with a frame type thing, because i have the top frame window holding the count script and the bottom table window as the table that actually views the site. So what i want to know is how do i get it so when i click the link it sends them to the site that they clicked for but still it counts it in the database without any frames being involved?
Here is an example of the code i have:
index.php
Code: Select all
<a href="./clicks.php?id=1" target="_blank">D-Frame</a>Code: Select all
<?
mysql_pconnect("localhost","dale","*****") or die(mysql_error());
mysql_select_db("dale1") or die(mysql_error());
$query = "SELECT * FROM site_links WHERE id=".$_GET['id']."";
$result = mysql_query($query) or die(mysql_error());
while($r=mysql_fetch_array($result))
{
$siteurl=$r["siteurl"];
echo "<html>
<head>
<title>Going Away</title>
</head>
<frameset rows="90,*" framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
<frame src="count.php" name="menu" scrolling="no" NORESIZE frameborder="0" marginwidth="0" marginheight="0" border="no">
<frame src="$siteurl" name="main" scrolling="auto" NORESIZE frameborder="0" marginwidth="0" marginheight="0" border="no">
</frameset>
</html>";
}
?>Code: Select all
<?
mysql_pconnect("localhost","dale","*****") or die(mysql_error());
mysql_select_db("dale1") or die(mysql_error());
$query = "UPDATE site_links SET count=count+1 WHERE id=".$_GET['id']."";
$result = mysql_query($query) or die(mysql_error());
?>(PS; Sorry if in wrong room!)