>I want to show info when my docs are viewed though my stats program. I have
>decieded the best way would be to put the info into a DB through php file
>then output the PDF, Excel, Zip or Powerpoint file.
>
>Only trouble is I have no Idea how to do this

Stuffing the actual data into your database doesn't really give you much
added value to tracking who is viewing it...

Write something like this:

---------- display.php ----------------------
<?php
  $query = "update stats set count = count + 1 where filename =
'$filename'";
  mysql_query($query) or error_log(mysql_error());

  # If it's the first time this file has ever been displayed...
  if (mysql_affected_rows() < 1){
    $query = "insert into stats(filename, count) values('$filename', 1)";
    mysql_query($query) or error_log(mysql_error());
  }

  readfile($filename);
?>
---------------------------------------------

You can then put your PDF files *outside* your web-tree so nobody can read
them, except like:

http://yourserver.com/display.php?filename=foo.pdf


-- 
Like Music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to