// Open the database connection $Connection = false; if ($WarningCollector->Count() == 0) { $Connection = @mysql_connect($DBHost, $DBUser, $DBPass); if (!$Connection) { $WarningCollector->Add("We couldn't connect to the server you provided (" . $DBHost . "). Are you sure you entered the right server, username and password?"); } elseif (!mysql_select_db($DBName, $Connection)) { $WarningCollector->Add("We connected to the server, but we couldn't access the \"" . $DBName . "\" database. Are you sure it exists and that the specified user has access to it?"); } } // Create the administrative user if ($WarningCollector->Count() == 0 && $Connection) { $Username = FormatStringForDatabaseInput($Username); $Password = FormatStringForDatabaseInput($Password); $s = new SqlBuilder($Context); $s->SetMainTable("User", "u"); $s->AddFieldNameValue("FirstName", "Administrative"); $s->AddFieldNameValue("LastName", "User"); $s->AddFieldNameValue("Email", FormatStringForDatabaseInput($SupportEmail)); $s->AddFieldNameValue("Name", $Username); $s->AddFieldNameValue("Password", $Password, 1, "md5"); $s->AddFieldNameValue("DateFirstVisit", MysqlDateTime()); $s->AddFieldNameValue("DateLastActive", MysqlDateTime()); $s->AddFieldNameValue("CountVisit", 0); $s->AddFieldNameValue("CountDiscussions", 0); $s->AddFieldNameValue("CountComments", 0); $s->AddFieldNameValue("RoleID", 6); $s->AddFieldNameValue("StyleID", 1); $s->AddFieldNameValue("UtilizeEmail", 0); $s->AddFieldNameValue("RemoteIP", GetRemoteIp(1)); if (!@mysql_query($s->GetInsert(), $Connection)) {
$Connection = @mysql_connect($DBHost, $DBUser, $DBPass); if (!$Connection) { $Context->WarningCollector->Add('We couldn’t connect to the server you provided (' . $DBHost . '). Are you sure you entered the right server, username and password?'); } elseif (!mysql_select_db($DBName, $Connection)) { $Context->WarningCollector->Add('We connected to the server, but we couldn’t access the \'' . $DBName . '\' database. Are you sure it exists and that the specified user has access to it?'); } elseif (version_compare(mysql_get_server_info($Connection), '4.1.0', '>=')) { /* On MySQL 4.1 and later, force UTF-8 */ mysql_query('SET NAMES "utf8"', $Connection); } } // Create the administrative user if ($Context->WarningCollector->Count() == 0 && $Connection) { $Username = FormatStringForDatabaseInput($Username); $Password = FormatStringForDatabaseInput($Password); $s = new SqlBuilder($Context); $s->SetMainTable('User', 'u'); $s->AddFieldNameValue('FirstName', 'Administrative'); $s->AddFieldNameValue('LastName', 'User'); $s->AddFieldNameValue('Email', FormatStringForDatabaseInput($SupportEmail)); $s->AddFieldNameValue('Name', $Username); $s->AddFieldNameValue('Password', $Password, 1, 'md5'); $s->AddFieldNameValue('DateFirstVisit', MysqlDateTime()); $s->AddFieldNameValue('DateLastActive', MysqlDateTime()); $s->AddFieldNameValue('CountVisit', 0); $s->AddFieldNameValue('CountDiscussions', 0); $s->AddFieldNameValue('CountComments', 0); $s->AddFieldNameValue('RoleID', 4); $s->AddFieldNameValue('StyleID', 1); $s->AddFieldNameValue('UtilizeEmail', 0); $s->AddFieldNameValue('RemoteIp', GetRemoteIp(1)); if (!@mysql_query($s->GetInsert(), $Connection)) {