<?php
  if(!empty($_POST['Change']))
  {
    $Min = $_POST['min'];
    $Max = $_POST['max'];
    $TypeFile = $_POST['typefile'];
    if($Min > $Max)
      $Errors[] = "Мин не должно быть больше Макс";
    if(empty($Errors))
    {
      $TypeArr = file($TypeFile);
      $TypeArr[1] = $Min."\n";
      $TypeArr[2] = $Max;
      SaveStringInFile($TypeFile, implode('', $TypeArr), 'w');
      Refresh($PageTmp);
    }
  }

  $Question = getquestion('../txt/'.$_GET['pswdfile'], $_GET['questlength']);
  $TypeFile = '../txt/'.str_replace('pswds', 'type', $_GET['pswdfile']);
  $TypeArr = file($TypeFile);
  $Min = trim($TypeArr[1]);
  $Max = trim($TypeArr[2]);
  $OptStr = "<option value=1>1<option value=2>2<option value=3>3<option value=4>4<option value=5>5<option value=6>6<option value=7>7<option value=8>8<option value=9>9<option value=10>10<option value=11>11<option value=12>12<option value=13>13<option value=14>14<option value=15>15<option value=16>16<option value=17>17<option value=18>18<option value=19>19<option value=20>20";
  print "<h5>$Heading_SetChoiceLimit</h5>";
  print "<h5><i>$Question</i></h5>";
  if($ShowTips == 'yes')
      ShowTips($Page);
  print "<form method=post action=''>";
  ShowErrors($Errors, '75%', 'VeryMiniField');
  print "<fieldset class=VeryMiniField align=center>";
    print "<table class=General align=center border=0 cellspacing=0 cellpadding=0 width=75%>";
      print "<tr>";
        print "<td>{$Cpt_Min}</td>";
        print "<td>";
          print "<select name=min>";
            $Tmp = str_replace("<option value={$Min}>{$Min}", "<option value={$Min} selected>{$Min}", $OptStr);
            print $Tmp;
          print "</select>";
        print "</td>";
        print "<td rowspan=2 align=center valign=middle><input class = ButtonSettings type=Submit name=Change value='{$Button_Change}'></td>";
      print "</tr>";
      print "<tr>";
        print "<td>{$Cpt_Max}</td>";
        print "<td>";
          print "<select name=max>";
            $Tmp = str_replace("<option value={$Max}>{$Max}", "<option value={$Max} selected>{$Max}", $OptStr);
            print $Tmp;
          print "</select>";
        print "</td>";
      print "</tr>";
    print "</table>";
  print "</fieldset>";
  print "<input type=hidden name=typefile value={$TypeFile}>";
  print "</form>";
?>