diff --git a/install.php b/install.php new file mode 100644 index 0000000..27698c9 --- /dev/null +++ b/install.php @@ -0,0 +1,444 @@ + + +
+ + +База данных успешно настроена
"; + print ""; + exit(); + + } + + } + + + + print "Введите параметры базы данных MySQL
"; + if(empty($error)) + print "Существующие данные в базе будут уничтожены!
"; + if(!empty($error)) + print "$error
"; + print ""; + +} + + + +// +// Настройка лицензии +// +function license() +{ + $license = ''; + $error = ''; + + $end = date("Y-m-d", time()+60*60*24*31); // на 31 день + $c = ''; + for($i=0; $iБлагодарим вас за использование лицензионной версии Simpla!
"; + + print ""; + exit(); + } + + + + } + + print "Для работы Simpla необходим лицензионный ключ:
"; + if(!empty($error)) + print "$error
"; + print ""; + exit(); + + + } + + } + + print "Задайте логин и пароль администратора сайта.
"; + if(!empty($error)) + print "$error
"; + print ""; +} + + +// +// Конечный шаг +// +function finalstep() +{ + @unlink('simpla.sql'); + @unlink('install.php'); + + if(is_file('install.php')) + $error = 'Обязательно удалите файлы install.php и simpla.sql'; + + $url = rtrim('http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['REQUEST_URI']), '/'); + print "Установка завершена успешно
"; + print "Адрес вашего сайта: $url
"; + print "Панель управления: $url/simpla
"; + print "Приятной работы с Simpla!
"; + if(!empty($error)) + print "$error
"; +} + + + + +function crypt_apr1_md5($plainpasswd) { + $salt = substr(str_shuffle("abcdefghijklmnopqrstuvwxyz0123456789"), 0, 8); + $len = strlen($plainpasswd); + $text = $plainpasswd.'$apr1$'.$salt; + $bin = pack("H32", md5($plainpasswd.$salt.$plainpasswd)); + for($i = $len; $i > 0; $i -= 16) { $text .= substr($bin, 0, min(16, $i)); } + for($i = $len; $i > 0; $i >>= 1) { $text .= ($i & 1) ? chr(0) : $plainpasswd{0}; } + $bin = pack("H32", md5($text)); + for($i = 0; $i < 1000; $i++) { + $new = ($i & 1) ? $plainpasswd : $bin; + if ($i % 3) $new .= $salt; + if ($i % 7) $new .= $plainpasswd; + $new .= ($i & 1) ? $bin : $plainpasswd; + $bin = pack("H32", md5($new)); + } + for ($i = 0; $i < 5; $i++) { + $k = $i + 6; + $j = $i + 12; + if ($j == 16) $j = 5; + $tmp = $bin[$i].$bin[$k].$bin[$j].$tmp; + } + $tmp = chr(0).chr(0).$bin[11].$tmp; + $tmp = strtr(strrev(substr(base64_encode($tmp), 2)), + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); + return "$"."apr1"."$".$salt."$".$tmp; +} + + + +################################################################## +################################################################## + + +function mysqlrestore($filename) +{ + $templine = ''; + $fp = fopen($filename, 'r'); + + // Loop through each line + if($fp) + while(!feof($fp)) { + $line = fgets($fp); + // Only continue if it's not a comment + if (substr($line, 0, 2) != '--' && $line != '') { + // Add this line to the current segment + $templine .= $line; + // If it has a semicolon at the end, it's the end of the query + if (substr(trim($line), -1, 1) == ';') { + // Perform the query + mysqli_query($GLOBALS['lk'], $templine) or print('Error performing query \'' . $templine . '\': ' . mysqli_error() . '