
<?php
  if(!empty($_POST['load']) && empty($Message))
  {
    $FileName = $_POST['filename'];
    $FileArr = @file($FileName);
    if(empty($FileArr))
      $Errors[] = $Err_CantLoad;
    else {
      //ищем совпадающие логины
      //доделать
      for($i = 0; $i < count($FileArr); $i++)
      {
        $FileArr[$i] = trim($FileArr[$i]);
        if(strlen($FileArr[$i]) > 30)
        {
          $Errors[] = "{$Err_InLine[0]} <b>".($i+1)."</b><br> {$Err_InLine[1]}";
          break;
        }

        elseif(($i % 2) == 1)
          $FileArr[$i] = md5(trim($FileArr[$i]))."\n";
      }
      if(empty($Errors))
      {
        $Message = SaveStringInFile($PswdFile, implode('', $FileArr), 'a');
        Refresh("ch_passwords&pswdfile={$PswdFile}&questlength={$QuestLength}");
      }
    }
  }

  //выводим форму
  print "<form action='' method=post>";
  print "<h4><i>{$Heading_lapfe_LoadUsersFromFile}</i></h4>";
  print "<h5><i>{$Question}</i></h5>";
  if($ShowTips == 'yes')
    ShowTips($Page);
  ShowErrors($Errors, '331', 'VeryMiniField');
  print "<fieldset class=VeryMiniField align=center>";
    print "<table class=General align=center border=0 cellspacing=0 cellpadding=0 width=100%>";
	    print "<tr>";
	      print "<td>{$Cpt_lapfe_LoadFromFile}</td>";
        print "<td>&nbsp;</td>";
      print "</tr>";
      print "<tr>";
        print "<td><input type=file name=filename></td>";
        print "<td>&nbsp;&nbsp;<input type=submit name=load value='{$Button_lapfe_Load}'></td>";
      print "</tr>";
    print "</table>";
  print "</fieldset>";
  print "</form>";

?>