PCCS MySQLDatabase Admin Tool version 1.3.4


/ -> mysqldb_create_hitcounter.php

1  <?php
2  /************************************************************************
3  PCCS MySQLDatabase Admin Tool
4  Copyright (C) Chauncey Thorn
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA , USA.
19  **************************************************************************/
20 
21  ///////////////////////////////////////////////////////////////////////////////
22  // Create Hit count function file
23  // no need to modify unless you like hacking
24  // bugs report to cthorn
25  ///////////////////////////////////////////////////////////////////////////////
26 
27  // Create a number hits file
28  // The httpd will need write access to the file...
29  //
30 
31  $textcnt_filename="pagecount_function.php";
32 
33  $textcnt = fopen($appfiledir . $textcnt_filename,"w");
34  fputs($textcnt,"<?php\n//** Generated by PCCS-MyAppGen $today\n");
35  fputs($textcnt,"/////////////////////////////////////////////////////////////////////////////////////\n");
36  fputs($textcnt,"// coder: cthorn\n");
37  fputs($textcnt,"////////////////////////////////////////////////////////////////////////////\n");
38  fputs($textcnt,"//\n");
39  fputs($textcnt,"// Include this file and call function in script\n");
40  fputs($textcnt,"// e.g countHits(\"index.php\");\n");
41  fputs($textcnt,"//\n");
42  fputs($textcnt,"// \$scriptname = the file you want track\n");
43  fputs($textcnt,"function countHits(\$scriptname) {\n");
44  fputs($textcnt," \$dirname = \"cntfiles\";\n");
45  fputs($textcnt," \$cnt_ext = \".txt\";\n");
46  fputs($textcnt," \$cntfile = \"\$scriptname\$cnt_ext\";\n");
47  fputs($textcnt,"\n");
48  fputs($textcnt," \$file = fopen(\"\$dirname/\$cntfile\",\"r+\");\n");
49  fputs($textcnt," \$count = file(\"\$dirname/\$cntfile\");\n");
50  fputs($textcnt," echo(\"This page has been viewed <font color=red> \$count[0] </font> times ...\");\n");
51  fputs($textcnt," \$new = \$count[0]+1;\n");
52  fputs($textcnt," fputs(\$file,\$new);\n");
53  fputs($textcnt,"}\n");
54  fputs($textcnt,"//\n");
55  fputs($textcnt,"//\n");
56  fputs($textcnt,"//////////////////////////////////////////////////////////////////////////\n");
57  fputs($textcnt,"?>\n");
58  fclose($textcnt);
59     
60 
61  ?>


Generated: Sat Jan 27 15:40:36 2001 Generated by PHPXref 0.1.2
PCCS-Linux.COM ::ource Advocate Articles catalogue
2000 2002