<?

  include_once '../../config.inc.php';
  if (!include '../autorization.php')
  {
    echo 'Access denied!';
    exit ();
  }

  if (!($result_proper = mysql_query ('select * from properties')))
  {
    exit ('<b>Error:</b>' . mysql_error ());
    ;
  }

  $proper = mysql_fetch_array ($result_proper);
  include '../lang/' . $proper['admin_language'];
  echo '<HTML><BODY STYLE="color: Navy;"><LINK HREF="../style.css" REL="stylesheet" TYPE="text/css"><TABLE WIDTH="600" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#505090;"><TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=5 BGCOLOR="#EFEFF8">
<TR><TD VALIGN=top BGCOLOR="#BFBFDF" STYLE="border-bottom: 1px solid #505090;"><FONT COLOR="navy"><B>';
  echo $admin_Manage_Polls;
  echo '</B></FONT></TD></TR><TR><TD VALIGN=top>

';
  echo '<S';
  echo 'CRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function confirmSubmit(record) 
{
if (confirm("Are you sure you wish to delete user \\"" + record + "\\"?"))
	return true ;
else
	return false ;
}
//-->
</SCRIPT>


';
  if ($_GET['delete'])
  {
    if (!(mysql_query ('' . 'DELETE FROM poll WHERE id=\'' . $_GET['delete'] . '\'')))
    {
      exit ('Query failed');
      ;
    }

    if (!(mysql_query ('' . 'DELETE FROM poll_result WHERE id=\'' . $_GET['delete'] . '\'')))
    {
      exit ('Query failed');
      ;
    }
  }

  echo '

';
  if ($_POST['modify'])
  {
    for ($i = 0; $i < $_POST['ans_count']; ++$i)
    {
      $answ = $answ . $_POST['answer' . $i] . '
';
    }

    $answ = trim ($answ);
    $SQL = '' . 'UPDATE poll SET question=\'' . $_POST['question'] . '\', answer=\'' . $answ . '\' WHERE id=\'' . $_POST['id'] . '\'';
    if (!(mysql_query ($SQL)))
    {
      exit ('Query failed');
      ;
    }
  }

  echo '


<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=3>
<TR BGCOLOR="#505090">
<TD><FONT COLOR="#FFFFFF">';
  echo $admin_table6[0];
  echo '</FONT></TD>
<TD><FONT COLOR="#FFFFFF">';
  echo $admin_table6[1];
  echo '</FONT></TD>
<TD ALIGN=center><FONT COLOR="#FFFFFF">';
  echo $admin_table6[2];
  echo '</FONT></TD>
</tr>

';
  if (!($result = mysql_query ('SELECT * FROM poll')))
  {
    exit ('Invalid query3');
    ;
  }

  while ($row = mysql_fetch_array ($result))
  {
    echo '<TR bgcolor="';
    if ($i++ % 2)
    {
      echo '#BFBFDF';
    }
    else
    {
      echo '#DCDCED';
    }

    echo '">
					<TD>';
    echo $row['id'];
    echo '</TD>
					<TD>';
    echo $row['question'];
    echo '</TD>
					<TD ALIGN=center>
						<A HREF="edit.php?id=';
    echo $row['id'];
    echo '"><IMG SRC="../images/edit.gif" ALT="Edit" BORDER=0></A>
						<A onclick="return confirmSubmit(\'';
    echo urlencode ($row['question']);
    echo '\')" HREF="index.php?delete=';
    echo $row['id'];
    echo '"><IMG SRC="../images/delete.gif" ALT="Delete" BORDER=0></A>
					</TD>
				</TR>';
  }

  echo '</TABLE>





</TD></TR></TABLE></TD></TR></TABLE></BODY></HTML>';
?>
