PCCS MySQLDatabase Admin Tool version 1.3.4


/ -> mysqldb_create_redirectscript.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 mypage.php
23  // redirect.php renamed to mypage.php
24  // no need to modify unless you like hacking
25  // bugs report to cthorn
26  ///////////////////////////////////////////////////////////////////////////////
27 
28 
29  $mypage_filename = "mypage.php";
30 
31  $mypage = fopen($appfiledir . $mypage_filename,"w");
32  fputs($mypage,"<?php\n// ** Generated by PCCS-MyAppGen\n");
33  fputs($mypage,"\n");
34  fputs($mypage," //////////////////////////////////////////////////\n");
35  fputs($mypage," // MyRedirector Version 1.0\n");
36  fputs($mypage," // Redirector\n");
37  fputs($mypage," // http://www.php-homepage.de\n");
38  fputs($mypage," // redirect.php3\n");
39  fputs($mypage," // Written by Mark Kronsbein\n");
40  fputs($mypage," // License: GPL\n");
41  fputs($mypage," // I only ask that you to NOT delete the credit!\n");
42  fputs($mypage," // Please mail me at mk\n");
43  fputs($mypage," // if you use this Script! Thanx!\n");
44  fputs($mypage," // See it in Action at http://www.php-homepage.de\n");
45  fputs($mypage," //\n");
46  fputs($mypage," // Installation:\n");
47  fputs($mypage," // Insert your Values for \$hostname, \$username,\n");
48  fputs($mypage," // \$password, \$userstable and \$dbName and \$host.\n");
49  fputs($mypage," // Call it like\n");
50  fputs($mypage," // redirect.php3?url=http://www.hostname.de\n");
51  fputs($mypage," // Modified by Chauncey Thorn\n");
52  fputs($mypage," // Changes: Intergrated into PCCS MySQLDatabase Admin Tool\n");
53  fputs($mypage," //////////////////////////////////////////////////\n");
54  fputs($mypage,"\n");
55  fputs($mypage,"require('dbinclude.php');\n");
56  fputs($mypage," \$host = \"http://Your URL Here/\";\n");
57  fputs($mypage," \$userstable = \"redirect\";\n");
58  fputs($mypage,"\n");
59  fputs($mypage," if (\$url != \$host){\n");
60  fputs($mypage," \$query = mysql_fetch_row(mysql_query( \"select * from \$userstable where(url = '\$url')\"));\n");
61  fputs($mypage,"\n");
62  fputs($mypage," if (\$query == false){\n");
63  fputs($mypage," \$hits = \"1\";\n");
64  fputs($mypage," \$query2 = \"INSERT INTO \$userstable (url,hits)
65  VALUES('\$url','\$hits')\";\n");
66  fputs($mypage," }\n");
67  fputs($mypage," else {\n");
68  fputs($mypage," \$hitquery = \"select hits from \$userstable where url =
69  '\$url'\";\n");
70  fputs($mypage," \$result = mysql_query(\$hitquery);\n");
71  fputs($mypage," \$hits = mysql_result(\$result, 0, \"hits\");\n");
72  fputs($mypage," \$query2 = \"update \$userstable set hits = hits+1 where url =
73  '\$url'\";\n");
74  fputs($mypage," }\n");
75  fputs($mypage,"\n");
76  fputs($mypage," MYSQL_QUERY(\$query2);\n");
77  fputs($mypage," }\n");
78  fputs($mypage," if(!\$url) {\n");
79  fputs($mypage," \$url = \"\$host\";\n");
80  fputs($mypage," }\n");
81  fputs($mypage," else {\n");
82  fputs($mypage," Header( \"Location: \$url\");\n");
83  fputs($mypage," }\n");
84  fputs($mypage,"\n");
85  fputs($mypage,"\n");
86  fputs($mypage,"\n");
87  fputs($mypage," ?>\n");
88  fputs($mypage,"\n");
89  fclose($mypage);
90 
91  ?>


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