<?

  include_once '../../lang/english.php';
  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="800" 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_Edit_Delete_comments;
  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 comment \\"" + record + "\\"?"))
	return true ;
else
	return false ;
}
//-->
</SCRIPT>





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

  echo '

';
  if ($_POST['go_comments'])
  {
    $SQL = '' . 'UPDATE comments SET name=\'' . $_POST['name'] . '\',email=\'' . $_POST['email'] . '\',comment=\'' . $_POST['article_comments'] . '\' WHERE id=' . $_POST['id'];
    if (!(mysql_query ($SQL)))
    {
      exit ('Query failed1');
      ;
    }
  }

  echo '


';
  if ($_GET['id'])
  {
    if (!($result1 = mysql_query ('' . 'SELECT * FROM articles WHERE id=' . $_GET['id'])))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    $row1 = mysql_fetch_array ($result1);
    if (!($result = mysql_query ('' . 'SELECT * FROM comments WHERE parent=' . $_GET['id'])))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    echo '
<b>Article:</b> ';
    echo $row1['title'];
    echo '<br><br>

<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=3>
<TR ALIGN=center BGCOLOR="#505090">
<td><FONT COLOR="#FFFFFF">';
    echo $admin_table1[1];
    echo '</FONT></td>
<td width=50><FONT COLOR="#FFFFFF">';
    echo $admin_table1[4];
    echo '</FONT></td>
</tr>

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

      echo '">

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

    echo '</TABLE>


';
  }

  echo '



';
  if ($_GET['edit'])
  {
    if (!($result = mysql_query ('' . 'SELECT * FROM comments WHERE id=' . $_GET['edit'])))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    $row = mysql_fetch_array ($result);
    echo '
<FONT style="color:navy;font-family:tahoma;font-size:11";>
<FORM ACTION="comments.php?id=';
    echo $_GET['id'];
    echo '" METHOD="post">
* Your Name:<br>
<input type="text" name="name" STYLE="width: 340px;" value="';
    echo $row['name'];
    echo '"><br>
* Your e-mail:<br>
<input type="text" name="email" STYLE="width: 340px;" value="';
    echo $row['email'];
    echo '"><br>
* Your comment:<br>
<textarea cols="64" rows="12" name="article_comments">';
    echo $row['comment'];
    echo '</textarea><br><br>
<input type="submit" name="go_comments" value="Save">
<input type="hidden" name="id" value="';
    echo $row['id'];
    echo '">
</form>
</FONT>
';
  }

  echo '


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