Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

php redirect, how


211655

Recommended Posts

Posted

hi, i have a banner add on my site that link to an external website link. i just want to check how many times someone has clicked that banner and went to the link. i have no way to check ot from that outside link so i need to find it on my own.

 

so i have this php code that actually writes the count to a file and then redirects . this doesnt work. any other ideasd...

 

 

<html>
<head>
<?php

   // path to counter.txt
   $counter_file = "counter.txt";
   // Open the file for reading
   if (!($fp = fopen($counter_file, "r"))) die ("Cannot Open $counter_file.");
   // Read 20 characters from the file
   $counter = (int) fread($fp, 20);
   // Close the file
   fclose($fp);
   // Increment the counter
   $counter++;

header('http://www.ggg.com/j.asp');
   // Open the file, in write mode
   $fp = fopen($counter_file, "w");
   // Write the new value of counter to the file.
   fwrite($fp, $counter);
   // Close the text file.
   fclose($fp);

?> 

</head>

</html>

Posted

what error are you getting? do u have 777 on the file?

Posted

Try to ulink the file before writing to it...

 

Bobby

Posted
no luck.... doesnt work.. any idea if anyone can rewrite

 

 

why don't you use the default banner manager, that has all the functionality in it.

Treasurer MFC

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...