Axel23
Начинающий
- Регистрация
- 25 Ноя 2012
- Сообщения
- 22
- Лучшие ответы
- 0
- Репутация
- 5
Здраствуйте форумчане это уже мой 2 урок в котором я роскажу как создать дополнительную функцию для вашего сайта install.php
Итак нам нужно только 3 файла которые и помогут нам создать етот "модуль".
install.php - Наш установщик
finish.php - Завершение
style.css - Стиль
Итак начнем, создаем файл install.php и пихаем код:
Далее создаем файл finish.php и пихаем код:
Создаем файл style.css и пихаем код:
Ну вот и все, должно работать, меняйте все под себя, кому что непонятно пишите помогу.
Думаю + заслужил.
Автор: Я
Итак нам нужно только 3 файла которые и помогут нам создать етот "модуль".
install.php - Наш установщик
finish.php - Завершение
style.css - Стиль
Итак начнем, создаем файл install.php и пихаем код:
PHP:
<html>
<head>
<title>Установка</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style>
input[type='submit'] {-moz-border-radius:4px;-webkit-border-radius:4px;border-radius: 4px; padding:2px 3px;border:1px solid #416796; text-shadow: 0 1px 0 #45688E; cursor: pointer; font-family: tahoma,verdana,arial,sans-serif,Lucida Sans; font-size: 11px; outline: medium none; white-space: nowrap; margin: 0; padding: 4px 11px; color:#f9f7f9; background:#5b7b9f url('http://new-info.ucoz.net/apo/23/knopki_kak_v_vkontakte1211f0ac3578.png'); background-repeat: repeat-x;}
</style>
</head>
<body>
<?
if(file_exists('install.lock')) {
echo 'Установка заблокирована файлом install.lock . Удалите этот файл и попробуйте снова.';
} else {
//Проверка на наличие файла блокировщика (если найден то скрипт заблокирован)
$page=$_GET["page"] ? (int)$_GET["page"] : "1";
//Конструкция для определения значения параметра $page
switch($page)
{
case "1":
$str="<h4>Установка</h4><br/>";
$str.="<div>
Добро пожаловать в систему установки. Мастер установки проведет вас через весь процесс установки.
</div> <div class='message unspecific note'>
Если вам нужна помощь по работе с мастером установки, то обратитесь к <b>документации</b>.
</div>
<br />
<div class='message unspecified'>
<strong>Системные требования</strong>
<br />
<strong>PHP:</strong> v5.1.0 или выше<br />
</div>";
$str.="<br><br><form action='?page=2' method='post' ><center><input type='submit' name='bsubmit' value='Далее' /></center></form>";
echo $str;
break;
case "2":
$str.="<h4>Установка</h4><br/>";
$str.="
<form action='?page=3' method='post' ><fieldset>
<legend>Конфигурации</legend>
<table style='width: 100%; border: 0px; padding:0px' cellspacing='0'>
<tr>
<td width='30%' class='title'>Адрес сайта:</td>
<td width='70%' class='content'><input type='text' name='scripturl' value='http://www.maximg.tk/' size='95'></td>
</tr>
<tr>
<td width='30%' class='title'>Название сайта:</td>
<td width='70%' class='content'><input type='text' name='title' value='' size='95'></td>
</tr>
</table>
</fieldset>";
$str.="<br><center><input type='submit' name='bsubmit' value='Далее' /></center></form>";
echo $str;
break;
case "3":
$str.="<h4>Установка</h4><br/>";
$str.="Создаем файлы<br/>";
echo 'Файл config.php ';
$fp = fopen ("config.php","w"); //Желательно не менять , но если заменили то ниже там где заполнение бд укажите путь к конфигу
fputs($fp,"<?php\n");
fputs($fp,'$scripturl = '."'".$_POST['scripturl']."';\n");
fputs($fp,'$Title = '."".$_POST['title'].";\n");
fputs($fp,"?>\n");
fclose($fp);
echo '<font color=green>создан</font><BR>';
// Создадим файл .htaccess и укажем в нем
// что по умолчанию нужно открывать файл index.php
echo 'Файл .htaccess ';
$f=fopen('.htaccess','w');
flock($f,LOCK_EX);
fputs($f,"DirectoryIndex index.php\n");
fputs($f,"RewriteEngine On\n");
flock($f,LOCK_UN);
fclose($f);
echo '<font color=green>создан</font><BR>';
echo 'Файл install.lock ';
$f=fopen('install.lock','w');
flock($f,LOCK_EX);
fputs($f,"Файл предназначен для блокировки файла install.php\n");
flock($f,LOCK_UN);
fclose($f);
echo '<font color=green>создан</font><BR>';
$str.="<br/><br/>";
$str.="<form action='finish.php' method='post' ><center><input type='submit' name='bsubmit' value='Далее' /></center></form><br/>";
echo $str;
break;
file_put_contents('install.lock',''); // создаем блокировщик
}
}
?>
</body>
</html>
PHP:
<html>
<head>
<title>Установка</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style>
input[type='sumbit'] {-moz-border-radius:4px;-webkit-border-radius:4px;border-radius: 4px; padding:2px 3px;border:1px solid #416796; text-shadow: 0 1px 0 #45688E; cursor: pointer; font-family: tahoma,verdana,arial,sans-serif,Lucida Sans; font-size: 11px; outline: medium none; white-space: nowrap; margin: 0; padding: 4px 11px; color:#f9f7f9; background:#5b7b9f url('http://new-info.ucoz.net/apo/23/knopki_kak_v_vkontakte1211f0ac3578.png'); background-repeat: repeat-x;}
</style>
</head>
<body>
<div id="wrap">
<div id="top"></div> <div id="content">
<?
$str.="<h4>Установка</h4>";
$str.="<Br><div class=message unspecific note> Поздравляем вас с успешной установкой <a href='/index.php'>MaximG</a></div>";
$str.="<br><div class='message unspecified'><strong>Завершения</strong><br>Для завершения установки удалите файл install.php.</div>";
$str.="<br><br><center><a href="index.php">На главную</a></center>";
echo $str;
?>
</body>
</html>
PHP:
/*-----------------------------------------------*/
/* This section resets default browser styles. */
/* You shouldn't need to edit this section. */
/*-----------------------------------------------*/
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { margin:0; padding:0; }
table { border-collapse:collapse; border-spacing:0; }
fieldset,img { border:0; }
address,caption,cite,code,dfn,em,strong,th,var { font-style:normal; font-weight:normal; }
ol,ul { list-style:none; }
caption,th { text-align:left; }
h1,h2,h3,h4,h5,h6 { font-size:100%; font-weight:normal; }
q:before,q:after { content:''; }
abbr,acronym { border:0; }
hr { display: none; }
/**
* New or modified styles
*/
body {
font-family: arial, verdana, tahoma, sans-serif;
font-size: 13px;
color: #1c2837;
padding: 0px 0px 0px 0px;
}
#login_controls {
margin: 0 auto;
width: 100%;
font-size: 12px;
}
#login_controls label {
display: block;
width: 35%;
color: #000;
float: left;
clear: both;
margin-bottom: 12px;
text-align: right;
padding-right: 15px;
}
#login_controls input {
margin-bottom: 12px;
font-size: 12px;
width: 45%;
}
.nav_button, .button, .realbutton {
-moz-border-radius-bottomleft:3px;
-moz-border-radius-bottomright:3px;
-moz-border-radius-topleft:3px;
-moz-border-radius-topright:3px;
background:#657B97 url(http://demo.ucpsamp.tk/admin/setup/public/images/gradient_bg.png) repeat-x scroll 70% 50%;
border:1px solid #3E546F;
color:#FFFFFF;
cursor:pointer;
padding:3px;
}
.message {
background-repeat: no-repeat;
background-position: 8px 10px;
padding: 10px 10px 10px 30px;
border-width: 1px;
border-style: solid;
border-color: #b0ce94;
background-color: #f1f6ec;
background-image: url(http://demo.ucpsamp.tk/admin/setup/public/images/information.png);
color: #3e4934;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
line-height: 150%;
}
.message.error {
background-color: #f3dddd;
background-image: url(http://demo.ucpsamp.tk/admin/setup/public/images/exclamation.png);
border-color: #deb7b7;
color: #281b1b;
font-size: 1.1em;
}
.message.unspecific {
background-color: #f3f3f3;
border-color: #d4d4d4;
color: #515151;
clear: both;
margin: 0 0 10px 0;
}
.message.unspecific.note {
background-color: #f9f7e0;
border-color: #eadca0;
margin-top: 8px;
}
#branding {
background: #1d3652 url("http://demo.ucpsamp.tk/admin/setup/public/images/branding_bg.png") repeat-x top;
height: 100px;
}
#navigation {
height: 31px;
background: transparent url(http://demo.ucpsamp.tk/admin/setup/public/images/sub_bar.png) repeat-x;
border-bottom: 5px solid #ae555b;
}
#navigation p {
float: right;
margin-right: 10px;
margin-top: 11px;
color: #e4eaf1;
font-size: 11px;
}
#navigation p a {
color: #e4eaf1;
text-decoration: none;
}
#navigation ul#section_buttons {
display: inline;
margin-top: -5px;
}
#navigation ul#section_buttons li {
float: left;
margin: 0px 0px 10px 10px;
padding: 0;
}
#navigation ul#section_buttons li span {
display: block;
padding: 7px 15px 13px 13px;
margin-right: -6px;
color: #acbbcc;
font-size: 1em;
text-decoration: none !important;
outline: 0;
}
#navigation ul#section_buttons li.active {
background: transparent url(http://demo.ucpsamp.tk/admin/setup/public/images/main_button_left.png) no-repeat;
position: relative;
top: -5px;
}
#navigation ul#section_buttons li.active span {
background: transparent url(http://demo.ucpsamp.tk/admin/setup/public/images/main_button_right.png) no-repeat top right;
color: #fff;
font-weight: bold;
padding-top: 10px;
}
#ipswrapper {
width: 100%;
margin: auto;
}
.main_shell {
background-color: #1d3652;
border: 1px solid #24426A;
width: 60%;
margin-left:auto;
margin-right:auto;
}
H1 {
margin: 0px;
background-image: url('http://demo.ucpsamp.tk/admin/setup/public/images/title_bar.gif');
padding: 7px 5px 6px 5px;
font-size: 13px;
color: #ffffff;
font-weight: bold;
}
H2 {
margin: 0px;
font-size: 18px;
}
H3 {
font-size: 11px;
margin: 0px;
}
TABLE {
font-size: 10px;
}
.content_shell
{
margin: 0px 3px 3px 3px;
border: 1px solid #24426A;
border-top: 3px solid #24426A;
background-repeat: repeat-x;
background-color: #D5DDE5;
}
.package {
clear:both;
height: 577px;
}
.content_wrap {
width: 70%;
height: 480px;
float: right;
margin: 6px 6px 4px 0px;
padding: 10px;
background-color: #ffffff;
border: 1px solid #000000;
line-height: 150%;
overflow: auto;
overflow-y:auto;
overflow-x:hidden;
}
.install_info {
float: left;
margin: -5px 0px 0px 10px;
font-size: 12px;
width: 23%;
}
.install_info H3 {
font-size: 15px;
color: #6D87A9;
}
.install_info UL {
margin: 0px;
margin-top: 15px;
padding-left: 25px;
list-style-type: none;
}
#progress .step_done {
list-style-image: url('http://demo.ucpsamp.tk/admin/setup/public/images/bullet_done.gif');
color: #44638E;
font-style: italic;
}
#progress .step_doing {
list-style-image: url('http://demo.ucpsamp.tk/admin/setup/public/images/bullet_doing.gif');
font-weight: bold;
}
#progress .step_doing p {
color: gray;
font-weight: normal;
}
#progress .step_notdone {
list-style-image: url('http://demo.ucpsamp.tk/admin/setup/public/images/bullet_notdone.gif');
}
.warning {
background-color: #EDF1AB;
border: 1px solid #6E704B;
padding: 5px;
font-weight: bold;
-moz-border-radius: 5px;
overflow: auto;
}
.hr {
margin: 4px 6px 0px 6px;
border-bottom: 1px solid #627686;
}
.copyright {
width: 98%;
text-align: right;
font-size: 9px;
color: #9EA7B3;
padding-top: 3px;
padding-right: 5px;
}
.eula {
height: 210px;
border: 1px solid #76774C;
background-color: #FDFDD3;
padding: 5px;
overflow: auto;
}
#auto_progress LI {
list-style: none;
color: #029901;
font-size: 11px;
font-weight: bold;
padding: 3px;
}
.done_text {
font-size: 14px;
font-weight: bold;
}
#links {
margin: 0px;
padding: 5px;
}
#links LI {
list-style: none;
}
.float_img {
float: left;
margin-right: 5px;
}
.info {
background-color: #DCE6F3;
border: 1px solid #5876A0;
padding: 4px;
line-height: 120%;
-moz-border-radius: 7px;
color: #1D3A60;
}
.sql_form {
width: 100%;
font-size: 11px;
border-top: 1px solid #6A6A6A;
border-left: 1px solid #6A6A6A;
border-right: 1px solid #A8A8A8;
border-bottom: 1px solid #A8A8A8;
}
FIELDSET {
padding: 10px 10px 10px 10px;
border-width: 1px;
border-style: solid;
border-color: #d5dde5;
background-color: #F1F4F7;
color: #3e4934;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
line-height: 150%;
}
FIELDSET LEGEND {
font-weight: bold;
}
TABLE .title {
color: #2D4461;
font-weight: bold;
padding-bottom: 3px;
}
TABLE .content {
padding-bottom: 3px;
}
Думаю + заслужил.
Автор: Я
Последнее редактирование: