Войти
Регистрация
VK
KATSTAT.RU-ТОП РЕЙТИНГ САЙТОВ С ОТДАЧЕЙ
Пиратская ферма, заходи, новичок
Уникальная онлайн игра! ЗАЙДИ И ОЦЕНИ!
NEAR wallet - mine HOT в Telegram
WorldByte - Наш хостинг - партнер
Помощь по скриптам
| Код выдернуть
Топ дня:
851386656
572505096
Автор
25 марта 2020, в 20:35
Рейтинг: 43
Привет, всем, какой код должен вставлятся в database.php
<?php
function is_ssl() {
if ( isset($_SERVER['HTTPS']) ) {
if ( 'on' == strtolower($_SERVER['HTTPS']) )
return true;
if ( '1' == $_SERVER['HTTPS'] )
return true;
} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
return true;
}
return false;
}
function view($file, $data = array()){
ob_start();extract($data);include $file.".php";$output = ob_get_contents();ob_clean();
return $output;
}
function base_path($remove = ''){
$root=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
$root.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
return str_replace($remove, '', trim($root,'/'));
}
function getBaseUrl($remove = true) {
$url = base_path();
if($remove) $url = str_replace(basename($url),"",$url);
return trim(str_replace('/install','',$url),"/");
}
function root_url(){
$root_url = strtok(trim(str_replace('/install', '', $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']),"/"),"?");
$root_url = str_replace("proccess.php","", $root_url);
$root_url = trim( $root_url,"/");
$root_url = trim(str_replace(['https','http',':','//','www.','index.php'],['','','','','',''],$root_url),"/");
return trim($root_url,"/");
}
function checkIsInstall(){
$ROOTDIR = str_replace(['install'], [''], __DIR__);
$dir = $ROOTDIR . '/application/config/database.php';
include $dir;
return isset($db['default']['database']);
}
function getInstall($user,$_data){
$root_url = root_url();
$base_url = getBaseUrl();
$ROOTDIR = str_replace(['install'], [''], __DIR__);
$data = array(
"email" => $user['email'],
"product_id" => 1,
"root_url" => $root_url,
"base_url" => $base_url
);
if ($user['email']) {
$output = '<?php if ( ! defined("BASEPATH")) exit("No direct script access allowed");' . "\n";
$output .= '$db["default"]["hostname"] = "' . $_data['db_hostname'] . '";' . "\n";
$output .= '$db["default"]["username"] = "' . $_data['db_username'] . '";' . "\n";
$output .= '$db["default"]["password"] = \'' . $_data['db_password'] . '\';' . "\n";
$output .= '$db["default"]["database"] = "' . $_data['db_database'] . '";' . "\n";
$output .= '$db["default"]["dbdriver"] = "mysqli";' . "\n";
$output .= '$db["default"]["dbprefix"] = "";' . "\n";
$output .= '$db["default"]["pconnect"] = FALSE;' . "\n";
$output .= '$db["default"]["db_debug"] = TRUE;' . "\n";
$output .= '$db["default"]["cache_on"] = FALSE;' . "\n";
$output .= '$db["default"]["stricton"] = FALSE;' . "\n";
$output .= '$db["default"]["cachedir"] = "";' . "\n";
$output .= '$db["default"]["char_set"] = "utf8";' . "\n";
$output .= '$db["default"]["dbcollat"] = "utf8_general_ci";' . "\n";
$output .= '$active_group = "default";' . "\n";
$output .= '$active_record = TRUE;' . "\n";
$dir = $ROOTDIR . '/application/config/database.php';
$databse_sql = file_get_contents('database.sql');
$con = mysqli_connect($_data['db_hostname'], $_data['db_username'], $_data['db_password'], $_data['db_database']);
$file = fopen($dir, 'w');
fwrite($file, $output);
fclose($file);
$res = mysqli_query($con, "SHOW TABLES");
if (mysqli_num_rows($res) == 0) {
$lines = explode("\n", $databse_sql);
$sql_query = '';
foreach($lines as $line) {
if ($line && (substr($line, 0, 2) != '--') && (substr($line, 0, 1) != '#')) {
$sql_query .= $line;
if (preg_match('/;\s*$/', $line)) {
mysqli_query($con, $sql_query);
$sql_query = '';
}
}
}
}
$dir = $ROOTDIR . '/application/config/config.php';
$handle = fopen($dir, "r");
$ci_config = '$config[\'base_url\']';
$new_congif = '';
$len = strlen($ci_config);
if ($handle) {
$found = false;
while (($line = fgets($handle)) !== false) {
if (!$found && strpos($line, $ci_config) !== false) {
$found = true;
$line = '$config[\'base_url\'] = \''. getBaseUrl() .'\';/*';
}
$new_congif .= PHP_EOL. $line;
}
fclose($handle);
$new_congif = preg_replace("/[\r\n]+/", "\n", $new_congif);
$new_congif = trim($new_congif);
file_put_contents($dir, $new_congif);
}
require_once 'version.php';
$newversion_file = '<?php define(\'SCRIPT_VERSION\', "'. SCRIPT_VERSION .'");';
file_put_contents($ROOTDIR."/install/version.php", $newversion_file);
$json['success'] = true;
} else {
$json['warning'] = (isset($data['error']) && $data['error']) ? $data['error'] : 'Unknown Error..!';
}
return $json;
}
P
A
I
N
25 марта 2020, в 21:35
Рейтинг: 2076
h
t
t
p
s
[!]
25 марта 2020, в 21:58
Грех Дизайна
?
81758652
25 марта 2020, в 22:05
Мой статус убежал от стыда )
это что )))
типо файл соединения с базой даных?
Форум
На главную
Онлайн:
5
Время: 23:43:35
Gen. 0.0768
(c) ByMAS.RU 2010-2024