function createConfigFile($name, $type, $host, $user, $password, $database, $table_prefix, $admin_user, $admin_password, $admin_email, $site_title) { $objResponse = new xajaxResponse(); $project7 = new editsee_App(); if (preg_match('/\\w*config\\w*\\.php/', $name) == 1 && !editsee_App::configFileExists()) { $filename = $name; $content .= '<?php /* EditSee config file */ $type = ' . "'{$type}';" . ' $host = ' . "'{$host}';" . ' $user = '******'{$user}';" . ' $password = '******'{$password}';" . ' $database = ' . "'{$database}';" . ' $table_prefix = ' . "'{$table_prefix}';" . ' ?>'; $filehandle = fopen($filename, 'w') or die("can't open file"); fwrite($filehandle, $content); fclose($filehandle); $project7->connectDatabase(); //attempt to create the user table $table_created = $project7->db->_query("\r\n\t\t\t\t\t\tCREATE TABLE IF NOT EXISTS `" . $table_prefix . "user` (\r\n\t\t\t\t\t\t`user_id` int(11) NOT NULL AUTO_INCREMENT,\r\n \t\t\t\t\t\t`username` varchar(255) NOT NULL,\r\n \t\t\t\t\t\t`role` varchar(6) NOT NULL,\r\n \t\t\t\t\t\t`email` varchar(255) NOT NULL,\r\n \t\t\t\t\t\t`password` char(32) NOT NULL,\r\n \t\t\t\t\t\tPRIMARY KEY (`user_id`),\r\n\t\t\t\t\t\tUNIQUE KEY `username` (`username`),\r\n\t\t\t\t\t\tUNIQUE KEY `e-mail` (`email`)\r\n\t\t\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;"); if ($table_created) { $insert_query = $project7->db->_insert_user($admin_user, 'admin', $admin_password, $admin_email); include 'includes/database/editsee_Database.create.php'; $script_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $objResponse->redirect($script_uri); } else { unlink($filename); $objResponse->alert('unable to insert into database!'); } } else { $objResponse->alert("Bad config file name!"); } return $objResponse; }