Please fill in all of the blanks.";
} else {
//Set configuration variables
$host = '$host = \'' . $_POST['host'] . "';";
$user = '$username = \'' . $_POST['user'] . "';";
$pass = '$password = \'' . $_POST['pass'] . "';";
$data = '$database = \'' . $_POST['data'] . "';";
$conf = '$configured = 1;';
if($_POST['log'] == 'on'){
$log = '$logging = TRUE;';
}else{
$log = '$logging = FALSE;';
}
$logfile = '$logfile = \'log.txt\'; ';
if($_POST['com'] == 'on'){
$com = '$allowcommands = TRUE;';
}else{
$com = '$allowcommands = FALSE;';
}
$finalconf = "";
//Open configuration file for editing
//This will clear any file that currently exists
$file = fopen("config.php","w");
//Write configuration data
fwrite($file,$finalconf);
//Close file
fclose($file);
$error = "
Configuration file created.";
if($_POST['crtdb'] == 'yes'){
//Attempt to connect to the database.
$dblink = @mysql_connect($_POST['host'], $_POST['user'], $_POST['pass']);
if($dblink == FALSE){
$error = "Database connection failed. Reason:" . mysql_error();
} else {
//If you connect ok, try creating the database.
$createdbquery = "CREATE DATABASE IF NOT EXISTS `$_POST[data]`;";
$cdb = mysql_query($createdbquery);
if ($cdb == FALSE){
$error = "Database creation falied. Reason:" . mysql_error();
} else {
//If the database is ok, add tables and data.
mysql_select_db($_POST['data']);
$catd = include('sql.php');
if ($replyquery == FALSE || $pendingquery == FALSE || $repliesquery == FALSE){
$error = "Table and data insert failed. Reason:" . mysql_error();
} else {
$error = "You should be set to go!
Make sure Catbot works, then
delete setup.php and sql.php.";
}
}
}
}
}
} else {
$error = "";
}
?>
Setup CatBot
Instructions:
- Host: URL or IP Address of mySQL database server.
- User Name: User name for database login.
- Password: Password for database login.
- Database: Name of database to be created.
- Hit Go!
It will be saved as config.php
- If you choose to enable logging, you can change the location of the logfile in config.php.
You cannot overwrite the replies, if you already have a database setup. You have to manually delete the existing tables first.
No comments:
Post a Comment