|
PCCS MySQLDatabase Admin Tool version 1.3.4
|
/installscript/ -> install.php
1 <?php
2 //** Generated by PCCS-MyAppGen 3 ///////////////////////////////////////////////////////////////////////////////////// 4 // Initial Install Script Coded: Chauncey Thorn (cthorn) 5 // 6 // Sunday, July 30, 2000 - John B. Abela (support)// Upgdate to PHP4, Total Rework of Variable Settings, 7 // Addition of INPUT fields for end-user, & author credit. 8 // 9 $install_apptitle = "TEsting 1"; // Your Application Name
10 $install_email = "cthorn"; // Your Email Address
11 $install_website = "http://web.txt.com/"; // Your Application Web Site Address
12 $install_websitehelp = "http://web.txt.com/help.php"; // Application Install Help (if it exists)$install_db_name = "eitsdb"; // ** Set This if your script requires a Hard-Coded Database Name!! **
13 $install_mysql_dump = "visitlog.mysql"; // Replace with your mysqldump file
14 $install_index_file = "index.php"; // Main File to your application
15 $install_mysql_exec = "-u root"; // Execute mysql client as this
16 ///////////////////////////////////////////////////////////////////////////////////// 17 // No Need To Edit Anything Below Here! 18 ///////////////////////////////////////////////////////////////////////////////////// 19 ?>
20
21 <HTML><HEAD>
22 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
23 <TITLE><?php echo $install_apptitle ?> Installation Script</TITLE></HEAD>
24 <BODY BGCOLOR="#EEEEEE" text="black" link="blue" vlink="blue">
25
26 <center><br><font face="Verdana" color="black" size="+2"><?php echo $install_apptitle; ?> Installation Script</font>
27 <br><font face="Verdana" color="blue" size="1"><a href="<?php echo $install_websitehelp; ?>" target="$install_websitehelp">Installation Help</a> | </font>
28 <font face="Verdana" color="blue" size="1"><a href="<?php echo $install_website; ?>" target="_blank"><?php echo $install_apptitle;?> Web Site</a></font>
29 <P>
30 <?php if($argv[0] == ""):?>
31 <CENTER>
32 <FORM ACTION=install.php?action=install METHOD=POST>
33 <p><BR>
34 <font face="Verdana" size="2">MySQL Server:</font> <INPUT TYPE="text" NAME="install_mysql_server" VALUE="localhost"><br>
35 <font face="Verdana" size="2">MySQL UserName:</font> <INPUT TYPE="text" NAME="install_mysql_user" VALUE="root"><br>
36 <font face="Verdana" size="2">MySQL Password:</font> <INPUT TYPE="text" NAME="install_mysql_passwd"><br>
37 <font face="Verdana" size="2">MySQL Location:</font> <INPUT TYPE="text" NAME="install_mysql_location" VALUE="/usr/local/bin/mysql"><br>
38 <font face="Verdana" size="2">Database Name:</font> <INPUT TYPE="text" NAME="install_db_name" VALUE=""><br>
39 <font face="Verdana" size="2">Database UserName:</font> <INPUT TYPE="text" NAME="install_db_user"><br>
40 <font face="Verdana" size="2">Database User Password:</font> <INPUT TYPE="text" NAME="install_db_password"><p>
41 <INPUT TYPE=submit VALUE="Install <?php echo $install_apptitle; ?>">
42 </FORM>
43 </CENTER>
44 <?php endif; ?>
45 <center><br><font face="Verdana" color="black" size="1">
46 Installation Script by: <a href="http://www.4cm.com/" target="_blank">www.4cm.com</a>
47 & <a href="mailto:cthorn\">Chauncey Thorn</a></font></center></BODY></HTML>
48 <?php
49 if($action == "install"):
50 $mysql_server ="localhost"; // mysql server
51 $mysql_user ="install_mysql_user"; // mysql user name
52 $mysql_passwd = "install_mysql_passwd"; // mysql password
53 $db_name = "eitsdb"; // db database name
54 $db_user = "installappdbpassword"; // db user name
55 $db_password = "install_db_password"; // db user passwd
56 $mysql_location = "install_mysql_location"; // Location of mysql client
57 $mysql_exec = "$install_mysql_exec"; // Execute mysql client as
58 $mysql_dump = "$install_mysql_dump"; // mysqldump
59 $index_file = "$install_index_file"; // Main Index File (something.php)
60 ///////////////////////////////////////////////////////////////////////////////// 61 // Connect to Database 62
63 function connectDB() {
64 global $mysql_server, $mysql_user, $mysql_passwd;
65 mysql_pconnect($db_name, $mysql_user, $mysql_passwd);
66 }
67 connectDB();
68
69 $create_webdb = "CREATE DATABASE $db_name";
70 $cwebdb = mysql_query($create_webdb);
71 if (!empty($cwebdb)) {
72 // Do Nothing
73 } else {
74 echo mysql_error()."<BR>
75 ";
76 }
77
78 $create_webuser = "GRANT SELECT,INSERT,UPDATE,DELETE on $db_name.*
79 TO $db_user@$mysql_server
80 IDENTIFIED by \'$db_password\'";
81 $cwebuser = mysql_query($create_webuser);
82 if (!empty($cwebuser)) {
83 // Do Nothing
84 } else {
85 echo mysql_error()."<BR>
86 ";
87 }
88
89 $create_tbl = "$mysql_location $mysql_exec $db_name < $mysql_dump";
90 exec($create_tbl);
91 ///////////////////////////////////////////////////////////////////////////////// 92 print "$install_apptitle has been installed.";
93 print " Click <a href=./$index_file>here</a> to test it out";
94 print "<BR>Please Email Any Bugs and Comments to: <a href=mailto:$install_email>$install_email</a>.";
95 ///////////////////////////////////////////////////////////////////////////////// 96 endif;
97 ?>
| |