/////////////////////////////////////////////////////////////////////////////////////
// Install script coder: Chauncey Thorn
// Email cthorn@wt.net
// Use this file to install your web application
// install.php3
//
$coder = "sdanic@memes.net"; // Your email
$packagename = "Lucid Fried Eggs"; // Your Application Name
$_title ="PHP Application Install Script Courtesy of Chauncey Thorn";
$_header = "
$_title
";
$_footer ="";
//
//
/////////////////////////////////////////////////////////////////////////////////////
//
print "$_header";
print "$_title : PHP Application Install
";
print "
";
print "";
print "";
if($argv[0] == ""):
print "
";
print "";
print "";
endif;
print "$_footer";
//
//
///////////////////////////////////////////////////////////////////////////////
if($action == "install"):
$db_server ="localhost";
$db_user ="root";
$db_passwd = "";
$appdbname = "lucid"; // Change this to your app database name
$appuser = "lucid"; // Change this to your app user name
$apppasswd = "scrambled"; // Change this to your app user passwd
$cmd_mysql = "/usr/local/bin/mysql"; // Location of mysql client
$cmd_par = "-u root"; // We will execute mysql client as
$myapp_dmp = "lucid.tablesetup.sql"; // Replace with your mysqldump
$app_index = "index.php3"; // Main File to your app
/////////////////////////////////////////////////////////////////////////////////
// Connect to Database
// You may not need to modify any thing here
//
function connectDB() {
global $db_host, $db_user, $db_passwd;
mysql_connect($db_name, $db_user, $db_passwd);
}
connectDB();
$create_webdb = "CREATE DATABASE $appdbname";
$cwebdb = mysql_query($create_webdb);
if (!empty($cwebdb)) {
// Do Nothing
} else {
echo mysql_error()."
\n";
}
$create_webuser = "GRANT SELECT,INSERT,UPDATE,DELETE on $appdbname.*
TO $appuser@$db_server
IDENTIFIED by \"$apppasswd\"";
$cwebuser = mysql_query($create_webuser);
if (!empty($cwebuser)) {
// Do Nothing
} else {
echo mysql_error()."
\n";
}
$create_tbl = "$cmd_mysql $cmd_par $appdbname < $myapp_dmp";
exec($create_tbl);
print "$packagename has been installed.";
print " Click here to test it out";
print "
Bugs and Comments $coder";
endif;
/////////////////////////////////////////////////////////////////////////////
?>