"$_POST[db_account]"))) { $error = "Could not connect to the Account database. Please make sure your given mssql values are correct."; } elseif (!sqlsrv_connect( $_POST['db_host'], array("Database"=>"$_POST[db_char]"))) { $error = "No wonder we can't connect, we're idiots. Could not connect to the Character database. Please make sure your given mssql values are correct"; } elseif ($_POST['srv_name'] == "") { $error = "Could not connect to the Character database. Please make sure your given mssql values are correct"; } elseif ($_POST['db_account'] == "") { $error = "Please give a valid Account database."; } elseif ($_POST['game_srv_ip'] == "") { $error = "Please put the Game Server IP into the field provided."; } elseif (!is_file($_POST['php_loc']) || !substr($_POST['php_loc'], -4) == '.exe') { $error = "That is not a valid file for your php file."; } elseif (!is_file("../includes/lang/$_POST[lang].php")) { $error = "Language file does not exist. Please use \"en\", unless you've translated yourself. This is still Beta, so I won't translate until it's at a work-able stage."; } if (!isset($error)) { $conn = sqlsrv_connect( $_POST['db_host'], array("Database"=>"$_POST[db_account]")); $result = sqlsrv_query($conn, "SELECT TOP 1 * FROM dbo.tUser WHERE [nAuthID] >= '9'", array(), array( "Scrollable" => SQLSRV_CURSOR_KEYSET)); if (sqlsrv_num_rows($result) == 0) { $error = "No accounts with nAuthID 9.
Please make sure you have at least one user with admin level 9+ to use fiemeCP, to use as a full-admin."; } else { //let's start building! //SQL STUFF: $_POST['php_loc'] = str_replace("'", "''", $_POST['php_loc']); $sql['1'] = "IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fUserSettings]') AND type in (N'U')) DROP TABLE [dbo].[fUserSettings]"; $sql['2'] = "IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fUserCPLog]') AND type in (N'U')) DROP TABLE [dbo].[fUserCPLog]"; $sql['3'] = "IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fSettings]') AND type in (N'U')) DROP TABLE [dbo].[fSettings]"; $sql['4'] = "IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fPlugins]') AND type in (N'U')) DROP TABLE [dbo].[fPlugins]"; $sql['5'] = "IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fPatches]') AND type in (N'U')) DROP TABLE [dbo].[fPatches]"; $sql['6'] = "IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fLoginLog]') AND type in (N'U')) DROP TABLE [dbo].[fLoginLog]"; $sql['7'] = "CREATE TABLE [dbo].[fUserSettings]( [user_id] [int] NOT NULL, [setting] [nvarchar](50) NOT NULL, [value] [nvarchar](50) NOT NULL )"; $sql['8'] = "CREATE TABLE [dbo].[fUserCPLog]( [id] [int] IDENTITY(1,1) NOT NULL, [type] [varchar](50) NOT NULL, [ip] [varchar](50) NOT NULL, [user_name] [varchar](50) NOT NULL, [time] [varchar](50) NOT NULL, [value_1] [nvarchar](max) NOT NULL, [value_2] [nvarchar](max) NULL, [value_3] [nvarchar](max) NULL )"; $sql['9'] = "CREATE TABLE [dbo].[fSettings]( [setting_order] [int] NULL, [setting_group] [nvarchar](50) NOT NULL, [setting_save_name] [nvarchar](50) NOT NULL, [setting_name] [nvarchar](50) NOT NULL, [setting_desc] [nvarchar](max) NULL, [setting_form] [nvarchar](max) NULL, [setting_form_type] [nvarchar](max) NOT NULL, [setting_value] [nvarchar](max) NULL )"; $sql['10'] = "CREATE TABLE [dbo].[fPlugins]( [plugin_name] [varchar](50) NOT NULL, [active] [int] NOT NULL )"; $sql['11'] = "CREATE TABLE [dbo].[fPatches]( [id] [int] IDENTITY(1,1) NOT NULL, [title] [varchar](50) NOT NULL, [notes] [nvarchar](max) NOT NULL, [patch_name] [nvarchar](50) NOT NULL, [postedby] [nvarchar](50) NOT NULL, [time] [nvarchar](50) NOT NULL, [ip_poser] [nvarchar](50) NOT NULL, [only_admin] [tinyint] NOT NULL, [deleted] [tinyint] NOT NULL )"; $sql['12'] = "CREATE TABLE [dbo].[fLoginLog]( [log_id] [int] IDENTITY(1,1) NOT NULL, [username] [varchar](50) NOT NULL, [password] [varchar](50) NULL, [ip] [varchar](50) NOT NULL, [time] [varchar](50) NOT NULL, [is_admin_login] [tinyint] NOT NULL, [success] [tinyint] NOT NULL, [login_cookie] [tinyint] NOT NULL )"; $sql['13'] = "INSERT INTO fSettings ([setting_order], [setting_group], [setting_save_name], [setting_name], [setting_desc], [setting_form], [setting_form_type], [setting_value]) VALUES('0', 'global', 'dev_mode', 'Developer Mode', 'Do you want to activate developer mode - all users are affected!', 'array(''1''=>''Yes'', ''0''=>''No'')', 'radio', '0'), ('0', 'global', 'dev_mode_admin', 'Admin Developer Mode', 'Add Developer Mode to the AdminCP (NOT RECOMMENDED)', 'array(''1''=>''Yes'', ''0''=>''No'')', 'radio', '0'), ('0', 'global', 'php_location', 'PHP location', 'Where is php.exe located?', '', 'text', '$_POST[php_loc]'), ('0', 'global', 'status_update', 'Server Status Refresh', 'How often will we check if the game servers are online/offline? Value in seconds
Default: 60', '', 'text', '60'), ('0', 'global', 'template_locations', 'Templates to Use', 'What templates do we want to use. Currently, only use \"fiedef\".', '', 'text', 'fiedef'), ('0', 'global', 'security_auto_hide', 'Auto Protect', 'Do we want to automatically protect sensitive data of FiemeCP? RECOMMENDED!', 'array(''1''=>''Yes'', ''0''=>''No'')', 'radio', '1'), ('0', 'global', 'security_auto_hide_overwrite', 'Overwrite when Auto Protecting?', 'Default: No', 'array(''1''=>''Yes'', ''0''=>''No'')', 'radio', '0'), ('0', 'global', 'security_auto_hide_htaccess', '.htaccess content', 'This is what will be added to the protected directories', '', 'textarea', 'order deny,allow deny from all'), ('0', 'global', 'admin_panel_min_entry', 'AdminCP access', 'What''s the minimum nAuthLevel to enter the AdminCP? Default: 7', '', 'text', '7'), ('0', 'global', 'admin_panel_folder', 'AdminCP folder', 'Where is the adminCP folder? Edit this for security reasons.', '', 'text', 'admin'), ('0', 'global', 'logging_logins', 'Log the Logins?', '2 = Log everywhere, 1 = Log only admin CP, 0 = log nothing', 'array(''0''=>''Log nothing'', ''1''=>''Log the AdminCP only'', 2=>''Log everything'')', 'radio', '2'), ('0', 'global', 'logging_logins_storetime', 'How long do we save the logs?', 'How long do we store the logs for (in seconds)? Default 1 week: 604800', '', 'text', '604800'), ('0', 'global', 'logging_logins_passwords', 'Save passwords when logging?', 'Do you want to store passwords in the logs? //2 = Log everywhere, 1 = Log only admin CP, 0 = log no passwords', 'array(''0''=>''Log nothing'', ''1''=>''Log the AdminCP only'', 2=>''Log everything'')', 'radio', '1'), ('0', 'global', 'logging_logins_passwords_conditions', 'Conditions for saving passwords', 'If we are logging the password, when do they need to be logged? 0 = only when wrong password, 1 = always', 'array(''0''=>''Only when wrong'', ''1''=>''Always'')', 'radio', '0'), ('0', 'leaderboard', 'lb_allow', 'Activate the Leaderboard?', '', 'array(''0''=>''No'', ''1''=>''Yes'')', 'radio', '1'), ('0', 'leaderboard', 'lb_top_howmany', 'List how many users', 'Top xx will be shown in the Leaderboards?', '', 'text', '20'), ('0', 'leaderboard', 'lb_min_adminlevel', 'Filter out GMs & Staff', 'What adminlevel, and below, will be accepted. The selected value WILL BE INCLUDED in your leaderboard', '', 'text', '10'), ('0', 'usercp', 'log_usercp', 'Log UserCP activity?', 'Recomended!', 'array(''0''=>''No'', ''1''=>''Yes'')', 'radio', '1'), ('0', 'usercp', 'keep_usercp_logs', 'Log Life', 'How long shall fieme keep the logs for?', '', 'text', '1814400'), ('0', 'usercp', 'user_see_account_id', 'Can users see their Account Number?', '', 'array(''0''=>''No'', ''1''=>''Yes'')', 'radio', '1'), ('0', 'usercp', 'user_change_gender', 'Allow Gender Change?', '', 'array(''0''=>''No'', ''1''=>''Yes'')', 'radio', '1'), ('0', 'usercp', 'user_change_gender_copper', 'Price for gender change', 'In copper', '', 'text', '1000000'), ('0', 'usercp', 'user_change_gender_fame', 'Fame for gernder change', 'In fame... duh?', '', 'text', '0'), ('0', 'usercp', 'user_change_name', 'Allow Name Change?', '', 'array(''0''=>''No'', ''1''=>''Yes'')', 'radio', '0'), ('0', 'usercp', 'user_change_name_copper', 'Price for name change', 'In copper', '', 'text', '5000000'), ('0', 'usercp', 'user_change_name_fame', 'Fame for name change', '', '', 'text', '5000'), ('0', 'member', 'register_captcha', 'Captcah when Registering?', 'Do the users need to enter a captcha when they register? Stops bots!', 'array(''0''=>''No'', ''1''=>''Yes'')', 'radio', '1'), ('0', 'member', 'register_licence', 'Show a licence?', 'Show licence to user?', 'array(''0''=>''No'', ''1''=>''Yes'')', 'radio', '1'), ('0', 'member', 'register_licence_content', 'Licence', '', '', 'textarea', 'You might want to change the licence here. This can be done in the AdminCP (Settings->Configuration->member) Use the language variable to have difference licences in different languages (Advanced!)'), ('0', 'member', 'register_min_pass_length', 'Minimim password length', '', '', 'text', '6')"; foreach ($sql as $num=>$query) { if (!sqlsrv_query($conn, $query, array(), array( "Scrollable" => SQLSRV_CURSOR_KEYSET))) { $error = "Oh no! Fieme encountered an error when executing sql script $num. Please send a report to xDario.

$query"; break; } } if (!isset($error)) { //SQL success! Let's write away if (preg_match('/^[0-9]{4}\-[0-9]{4}\-[0-9]{4}\-[0-9]{4}$/i', $_POST['serial'])) { $extra = " \$cfg['serial'] = \"$_POST[serial]\"; "; } else { $extra = ""; } $file = fopen("../includes/cfg.php", "w+"); $content = ""; fwrite($file, $content); fclose($file); $file = fopen("LOCK", "w+"); $content = " $error"; } } ?> Installing fiemeCP - xDario
Dear valued developer,

Welcome to the fresh installation, of the fiemeCP script. (Current Revision: $current_rev)
Please notice: FiemeCP is still under development. Make sure you are always running the newest version.

If you wish you upgrade your script, rather than re-installing, please click here.
This feature is only available from revision 0.8 onwards.

MANUAL WORK!
While most of the script works automatically, the following is up to you!
-> YOU must make backups of your databases! While fieme has worked perfectly up until now, there is a small chance that a bug damages your databses.
-> YOU must install the correct .dlls that include the functions we need. Please read the documentation, currently on the release thread on Kryptodev.

You can pretty much leave thease default, unless you know you changed something during the installing of the server.
Your Server Name
MsSQL Host
Account Database
Character Database

The following are used to check the server status, and are unique to your sever.
If they are incorrectly inputted, or you need more profound edits, they must be done manually in /includes/cfg.php
No checks are done to make sure that your input is correct!
Game server IP

FiemeCP settings. These are vital to make fiemeCP's core run properly.
You can edit all the things at a later stage from the Administrator Panel - but these are vital!
Php.exe Location
So, now we chose the language to install. Currently, only English (en) is available - however, if you've decided to translate the minimal stuff that's there, feel free to do so. The language code is the name of the folder in which the language files are included.
Language

OPTIONAL
A fiemeCP serial is only given out to closed-revision testers. You may request one from me, but it's not vital. In furutre revisions, the serial will acts a gateway between fieme and the public content such as skins and plugins - allowing you to easily access a bundle of content.
fieme Serial

By continuing, you agree to fieme's licence, and agree that you have not modified it.
"; } elseif ($_POST['step'] == 1) { echo "

I'm finished!

Wasn't that fun?

I bet you didn't watch that video. Meenie
(I don't blame you)


Then watch this. Is nothing like bluewaffle.



Everything ran successfully, and you're ready to start! Install file locked. Click here to play with your new copy of fiemeCP!"; } echo "
fiemeCP installer, theme, and the program itself are ©2011xDario. All Rights Reserved.
Do not distribute, or use for any other purpose than written for, unless prior written consent by xDario.
"; function trim_value(&$value) { $value = trim($value); }