PCCS MySQLDatabase Admin Tool version 1.3.4


/ -> mysqldb_create_redirstatscript.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 redir_stats.php
23  // Stats viewer script for the redirect.php
24  // no need to modify unless you like hacking
25  // bugs report to cthorn
26  ///////////////////////////////////////////////////////////////////////////////
27 
28 
29  $redirstat_filename = "redir_stats.php";
30 
31  $redirstat = fopen($appfiledir . $redirstat_filename,"w");
32  fputs($redirstat,"<?php\n// ** Generated by PCCS-MyAppGen $today\n");
33  fputs($redirstat,"\n");
34  fputs($redirstat," ////////////////////////////////////////////////// \n");
35  fputs($redirstat," // MyRedirector Version 1.0\n");
36  fputs($redirstat," // Stats-Viewer \n");
37  fputs($redirstat," // http://www.php-homepage.de\n");
38  fputs($redirstat," // viewstats.php3\n");
39  fputs($redirstat," // Written by Mark Kronsbein\n");
40  fputs($redirstat," // License: GPL\n");
41  fputs($redirstat," // I only ask that you to NOT delete the credit!\n");
42  fputs($redirstat," // Please mail me at mk\n");
43  fputs($redirstat," // if you use this Script! Thanx!\n");
44  fputs($redirstat," // See it in Action at http://www.gabber.de\n");
45  fputs($redirstat," // \n");
46  fputs($redirstat," // Installation:\n");
47  fputs($redirstat," // Insert your Values for \$hostname, username,\n");
48  fputs($redirstat," // \$password, \$userstable and \$dbName.\n");
49  fputs($redirstat," //////////////////////////////////////////////////\n");
50  fputs($redirstat,"\n");
51  fputs($redirstat," require('dbinclude.php');\n");
52  fputs($redirstat," \$userstable = \"redirect\";\n");
53  fputs($redirstat,"\n");
54  fputs($redirstat," \$color10 = \"#FFFF00\"; /* Color for Hits between 1 and 9 */\n");
55  fputs($redirstat," \$color20 = \"#FF0000\"; /* Color for Hits between 10 and 19 */\n");
56  fputs($redirstat," \$color50 = \"#008000\"; /* Color for Hits between 20 and 49 */\n");
57  fputs($redirstat," \$color1k = \"#0000FF\"; /* Color for Hits between 50 and 99 */\n");
58  fputs($redirstat," \$color2k = \"#0000A0\"; /* Color for Hits between 100 and 199 */\n");
59  fputs($redirstat," \$color5k = \"#000040\"; /* Color for Hits over 200*/ \n");
60  fputs($redirstat,"\n");
61  fputs($redirstat," \$query = \"select * from \$userstable order by hits desc\";\n");
62  fputs($redirstat," \$result = MYSQL_QUERY(\$query);\n");
63  fputs($redirstat," \$number = MYSQL_NUMROWS(\$result) or die (mysql_error());\n");
64  fputs($redirstat,"\n");
65  fputs($redirstat,"\$i = 0;\n");
66  fputs($redirstat,"\n");
67  fputs($redirstat," IF (\$number == 0) { \n");
68  fputs($redirstat," PRINT \"<CENTER><P><b>No Links tracked yet!</b></CENTER>\";\n");
69  fputs($redirstat," }\n");
70  fputs($redirstat," ELSEIF (\$number >= 1) {\n");
71  fputs($redirstat," WHILE (\$i < \$number){ \n");
72  fputs($redirstat," \$hits = mysql_result(\$result,\$i,hits);\n");
73  fputs($redirstat," \$url = mysql_result(\$result,\$i,url);\n");
74  fputs($redirstat," if (\$hits < 10){ \n");
75  fputs($redirstat," \$color = \"\$color10\";\n");
76  fputs($redirstat," } \n");
77  fputs($redirstat," elseif ((\$hits >= 10 ) AND (\$hits < 20)){\n");
78  fputs($redirstat," \$color = \"\$color20\";\n");
79  fputs($redirstat," }\n");
80  fputs($redirstat," elseif ((\$hits >= 20 ) AND (\$hits < 50)){\n");
81  fputs($redirstat," \$color = \"\$color50\";\n");
82  fputs($redirstat," }\n");
83  fputs($redirstat," elseif ((\$hits >= 50 ) AND (\$hits < 100)){\n");
84  fputs($redirstat," \$color = \"\$color1k\";\n");
85  fputs($redirstat," }\n");
86  fputs($redirstat," elseif ((\$hits >= 100 ) AND (\$hits < 200)){\n");
87  fputs($redirstat," \$color = \"\$color2k\";\n");
88  fputs($redirstat," }\n");
89  fputs($redirstat," elseif (\$hits >= 200){ \n");
90  fputs($redirstat," \$color = \"\$color5k\";\n");
91  fputs($redirstat," }\n");
92  fputs($redirstat," PRINT \"<div align=\\\"left\\\">\";\n");
93  fputs($redirstat," print \"<table COLS=3 border=\\\"0\\\" width=\\\"100%\\\"><tr><td
94  ALIGN=LEFT with=\\\"400\\\"><b><a \n");
95  fputs($redirstat," href=\\\"\$url\\\">\$url</a></b></td>\";\n");
96  fputs($redirstat," print \"<td ALIGN=right WIDTH=\\\"60\\\"><b>\$hits</b></td>\";\n");
97  fputs($redirstat," print \"<td align=left WIDTH=\\\"\$hits\\\"
98  BGCOLOR=\\\"\$color\\\">&nbsp;</td></tr>\";\n");
99  fputs($redirstat," \$i++;\n");
100  fputs($redirstat," PRINT \"</table>\\n\";\n");
101  fputs($redirstat," }\n");
102  fputs($redirstat," }\n");
103  fputs($redirstat," ?>\n");
104  fputs($redirstat,"\n");
105  fclose($redirstat);
106 
107  ?>


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