Redirecting pdf files

Post your Click counter digestion problems here
Post Reply
pisanggoreng
Posts: 2
Joined: Tue May 22, 2007 8:43 pm

Redirecting pdf files

Post by pisanggoreng »

I have been using ccount for some time now, and really like it. My problem is that I use it to count clicks on pdf files, and these files open in the web browser with the "original" URL in it. Thus, if someone clicks on a link and then want to tell his friends about this document, then he may copy the original URL from the webbrowser and send that to his friend. When his friend clicks this link, the document will open, but the click will not be counted as he is not using the ccount link.

(Did that make sense?)

I would like to redirect the pdf files so that only the ccount URL shows in the web browser. Is that possible?

Thanks in advance.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

The only way I can think of would be with the help of frames. Open click.php in a plain text editor (Notepad) and change line

Code: Select all

Header("Location: $url");
to

Code: Select all

echo '
<html>
<frameset rows="0,100%" border="0">
  <frame frameborder=0 src="blank.htm" />
  <frame frameborder=0 src="'.$url.'" />
  <noframes>
  <p><a href="'.$url.'">Click to continue</a></p>
  </noframes>
</frameset>
</html>
';
If you just want to use this for PDF files and no other you can simply edit one copy of click.php and rename it to for example click_pdf.php and use the normal click.php for other files.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
pisanggoreng
Posts: 2
Joined: Tue May 22, 2007 8:43 pm

Post by pisanggoreng »

Thanks a lot! It works perfect! :)
Post Reply