View file flud/js/add_list.php

File size: 2.97Kb
<?php
session_start();
$ms_pol = $_GET['ms_pol'];
if ($_SESSION['user_login'] == '')
{
 echo 'Ошибка! Файл не может быть загружен!';
 exit;
}
echo '<head><title>JPEList - редактор списков</title></head>';
if ($_POST['step'] == '' or $_POST['step'] == '1')
{
?>
<span class="ramka">
 <form name="" action="" method="post">
  Количество пунктов списка:<br>
  <input name="kol" type="text" value=""><br>
  <input name="step" type="hidden" value="2">
  <input name="num" type="hidden" value="1">
  <input type="submit" value="Добавить">
 </form>
</span>
<?php
}
elseif ($_POST['step'] == '2')
{

echo 'Заполните списки:<br>';

if (is_numeric($_POST['kol']))
$cnt = $_POST['kol'];
else
$cnt = 2;

$in = 1;
echo '<form name="" action="" method="post">';

if ($_POST['num'] == 1)
echo '<ol type="'.$_POST['t_ol'].'">';
else
echo '<ul type="'.$_POST['t_ul'].'">';

while ($in <= $cnt)
{
echo '<li><input name="text_'.$in.'" type="text" value="'.$_POST['text_'.$in.''].'"></li>';
$in++;
}

if ($_POST['num'] == 1)
echo '</ol>';
else
echo '</ul>';

if ($_POST['num'] == 1)
{
echo ' <input name="num" type="radio" value="1" checked> Нумерованый<br> ';
echo ' <select size="1" name="t_ol"> ';
?>
 <option <?php if ($_POST['t_ol'] == '1') echo 'selected';?> value="1">1,2,3...&infin;</option>
 <option <?php if ($_POST['t_ol'] == 'A') echo 'selected';?> value="A">A,B,C...Z</option>
 <option <?php if ($_POST['t_ol'] == 'a') echo 'selected';?> value="a">a,b,c...z</option>
 <option <?php if ($_POST['t_ol'] == 'I') echo 'selected';?> value="I">I,II,III...&infin;</option>
 <option <?php if ($_POST['t_ol'] == 'i') echo 'selected';?> value="i">i,ii,iii...&infin;</option>

<?php
echo ' </select> <br>';
echo '
<input name="num" type="radio" value="0"> Маркерованый<br>
';
}
else
{
echo '
<input name="num" type="radio" value="1" > Нумерованый<br>
';
echo '
<input name="num" type="radio" value="0" checked> Маркерованый<br>
';
echo ' <select size="1" name="t_ul"> ';
?>
 <option <?php if ($_POST['t_ul'] == 'disc') echo 'selected';?> value="disc">Диск</option>
 <option <?php if ($_POST['t_ul'] == 'circle') echo 'selected';?> value="circle">Овал</option>
 <option <?php if ($_POST['t_ul'] == 'square') echo 'selected';?> value="square">Квадрвт</option>

<?php
echo ' </select> <br>';
}
echo '
<br>
Пунктов<br>
<input name="kol" type="text" value="'.$cnt.'">
<br>
<input name="step" type="radio" value="2" checked> Не готово<br>
<input name="step" type="radio" value="3"> Готово<br>
<input type="submit" value="Обновить">
';
echo '</form>';

}
elseif ($_POST['step'] == '3')
{

$cnt = $_POST['kol'];
$in = 1;
if ($_POST['num'] != 1)
$past = '[list1 type='.$_POST['t_ul'].'=list]';
else
$past = '[list2 type='.$_POST['t_ol'].'=list]';
while ($in <= $cnt)
{
$past = $past.'[li]'.$_POST['text_'.$in.''].'[/li]';
$in++;
}
if ($_POST['num'] != 1)
$past = $past.'[/list1]';
else
$past = $past.'[/list2]';
         include('js_inc.php');
}
?>