DS Donation System Copyright (C) 2009 W. Weber This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
EOF; } function reconf() { $f = fopen(getcwd().'/includes/libs/config.php','w+'); fwrite($f," $value) { $value = addslashes($value); $key = explode('-',$key); if($key[0] == 'cfg') { if($key[2] != null) { fwrite($f,"\$CONFIG['{$key[1]}']['{$key[2]}']='$value';\r\n"); } else { fwrite($f,"\$CONFIG['{$key[1]}']='$value';\r\n"); } } elseif($key[0] == 'cfg_bool') { fwrite($f,"\$CONFIG['{$key[1]}']=$value;\r\n"); } } fwrite($f,"?>"); fclose($f); form(); } function query() { @include getcwd().'/includes/libs/config.php'; $query = " CREATE TABLE `ds_logs` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `status` tinyint(3) unsigned NOT NULL DEFAULT '0', `gateway` varchar(16) NOT NULL DEFAULT '', `user` varchar(64) NOT NULL DEFAULT '', `date` datetime DEFAULT NULL, `transaction_id` varchar(32) NOT NULL DEFAULT '', `amount` float NOT NULL DEFAULT '0', `account` int(10) unsigned NOT NULL DEFAULT '0', `info` blob, PRIMARY KEY (`id`) ) "; $query2 = " CREATE TABLE `ds_points` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `points` int(11) DEFAULT '0', PRIMARY KEY (`id`) ) "; $query3 = " CREATE TABLE `ds_realms` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL DEFAULT '', `host` varchar(32) NOT NULL DEFAULT '', `user` varchar(32) NOT NULL DEFAULT '', `pass` varchar(32) NOT NULL DEFAULT '', `db` varchar(32) NOT NULL DEFAULT '', PRIMARY KEY (`id`) ) "; $query4 = " CREATE TABLE `ds_rewards` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `realm` tinyint(4) NOT NULL DEFAULT '0', `name` varchar(64) NOT NULL DEFAULT '', `description` text, `cost` smallint(5) unsigned NOT NULL DEFAULT '0', `items` text, `gold` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) "; $sql = mysql_connect($CONFIG['sql']['host'],$CONFIG['sql']['user'],$CONFIG['sql']['pass']); mysql_select_db($CONFIG['sql']['db']); mysql_query($query); mysql_query($query2); mysql_query($query3); mysql_query($query4); form(); } if(isset($_POST['config'])) { reconf(); } elseif(isset($_POST['query'])) { query(); } else { form(); } ?>This tool will allow you to configure DS. Be sure that this file is not accessible once you are finished.