Lunarpages Web Hosting Forum

Author Topic: test beta counter  (Read 3045 times)

Offline Rưan_

  • Spaceship Captain
  • *****
  • Posts: 119
    • http://is0lized.net
test beta counter
« on: November 07, 2001, 03:25:00 PM »
hello, if you are intrested in a counter for your web page, use this.. i was reading a perl book and make this... i think it works havnt tested it


<BLOCKQUOTE><font size="1" face="Verdana, Helvetica, sans-serif">code:</font><HR><pre>
#!/usr/bin/perl

//////////////////////////////////////////
//       Is0lized CGI - Counter         //
//--------------------------------------//
//      author:           //
//        email:        //
//            web:        //
//--------------------------------------//
//        11.05.01 - Version 1.0        //
//////////////////////////////////////////


open (COUNTER_READ, "counterdata.txt");
$counter = <COUNTER_READ> + 1;
close(COUNTER_READ);
print " $counter times.<br>\n";
open (COUNTER_WRITE, ">counterdata.txt");
print COUNTER_WRITE $counter;
close (COUNTER_WRITE);
</pre><HR></BLOCKQUOTE>

[ November 07, 2001: Message edited by: Rưan ]
« Last Edit: June 27, 2011, 04:34:29 AM by FlorinB »
Hi! I'm a .signature *virus*! Copy me into your ~/.signature to help me spread!

Offline TWebMan

  • Quantum Encyclopedia Writer
  • *****
  • Posts: 3047
    • Take charge of your site
test beta counter
« Reply #1 on: November 09, 2001, 02:42:00 AM »
Good work, but you left out the line that actually prints into counterdata.txt.  Here is the script with the line, and it works great!  

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">code:</font><hr><pre>
#!/usr/bin/perl

//////////////////////////////////////////
//       Is0lized CGI - Counter         //
//--------------------------------------//
//      author:            //
//        email:         //
//            web:          //
//--------------------------------------//
//        11.05.01 - Version 1.0        //
//////////////////////////////////////////

#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
open (COUNTER_READ, "counterdata.txt");
$counter = <COUNTER_READ> + 1;
close(COUNTER_READ);
print "<center>Thanks for being visitor number $counter.</center><br>\n";
open (COUNTER_WRITE, ">counterdata.txt");
print(COUNTER_WRITE $counter);
close (COUNTER_WRITE);
sleep(1);
</pre><hr></blockquote>

[ November 09, 2001: Message edited by: TWebMan ]</p>
« Last Edit: June 27, 2011, 04:34:51 AM by FlorinB »
"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site

Offline Santos

  • Galactic Royalty
  • *****
  • Posts: 479
    • http://www.dtnetworking.com
test beta counter
« Reply #2 on: November 09, 2001, 04:01:00 PM »
Leave it to Web man to find that mistake. Nice eye.
Smile, it makes people wonder what you're up to...