<?php
  require ("vote.php");

    myflock();
    $i=0; $qall=0;
    $vnq=array();
    $vnn=array();
    $f=fopen("votion.dat","r");
    $vn=fgets($f,10);
    $vq=fgets($f,100);
    for ($i=1; $i<=$vn; $i++)
    {
      $t=fgets($f,100);
      array_push($vnq,$t);
    }
    for ($i=1; $i<=$vn; $i++)
    {
      $t=fgets($f,5);
      array_push($vnn,$t);
      $qall+=$t;
    }
    fclose($f);
    myfunlock();
?>
<html>
<meta http-equiv="content-type" content="text/html; charset=windows-1251">
  <title>WFVote administration page</title>
  <body bgcolor=#000000>
    <font color=#ffffff>
    WFVote administration page.<br>
    <?php
      if (!((isset($admpwd))&&(legal($admpwd))))
      {
    ?>
    Password:
    <form action="voteadm.php">
      <input type=password name=admpwd>
      <input type=submit value=Ok>
    </form>
    <?php
      } else {
    ?>
    <form action="setvote.php">
    <fieldset>
      <center><b>Question properties:</b><br>
      Question<br>
      <input type=text name=qq <?php echo ("value='".$vq."'") ?> size=80%><br>
      Answers count<br>
      <input type=text name=qn <?php echo ("value='".$vn."'") ?> size=80%><br>
      Answers<br>
      <input type=text name=ql1 <?php if (isset($vnq[0])) echo ("value='".$vnq[0]."'") ?> size=80%><br>
      <input type=text name=ql2 <?php if (isset($vnq[1])) echo ("value='".$vnq[1]."'") ?> size=80%><br>
      <input type=text name=ql3 <?php if (isset($vnq[2])) echo ("value='".$vnq[2]."'") ?> size=80%><br>
      <input type=text name=ql4 <?php if (isset($vnq[3])) echo ("value='".$vnq[3]."'") ?> size=80%><br>
      <input type=text name=ql5 <?php if (isset($vnq[4])) echo ("value='".$vnq[4]."'") ?> size=80%><br>
      <input type=text name=ql6 <?php if (isset($vnq[5])) echo ("value='".$vnq[5]."'") ?> size=80%><br>
      <input type=text name=ql7 <?php if (isset($vnq[6])) echo ("value='".$vnq[6]."'") ?> size=80%><br>
      <input type=text name=ql8 <?php if (isset($vnq[7])) echo ("value='".$vnq[7]."'") ?> size=80%><br>
      <input type=text name=ql9 <?php if (isset($vnq[8])) echo ("value='".$vnq[8]."'") ?> size=80%><br>
      <input type=submit value='  Ok  '></center>
    </fieldset>
    </form>
    <form action="setadmpw.php">
    <fieldset>
      <center><b>Password changing</b><br>
      Old password<br>
      <input type=password name=oldpwd><br>
      New password<br>
      <input type=password name=admpwd1><br>
      New password again<br>
      <input type=password name=admpwd2><br>
      <input type=submit value='  Ok  '></center>
    </fieldset>
    </form>
    <?php
      }
    ?>
    </font>
  </body>
</html>
