<?

  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_Edit_Banner;
  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 ($_POST['ban_upload'])
  {
    $SQL1 = '' . 'select * from ban_source WHERE id=\'' . $_POST['id'] . '\'';
    if (!($result1 = mysql_query ($SQL1)))
    {
      exit ('Query failed');
      ;
    }

    $row1 = mysql_fetch_array ($result1);
    if ($_FILES['image']['name'])
    {
      if (file_exists ($documentroot . ('' . '/upload/banners/' . $row1['image'])))
      {
        unlink ($documentroot . ('' . '/upload/banners/' . $row1['image']));
      }

      if (copy ($_FILES['image']['tmp_name'], $documentroot . ('' . '/upload/banners/' . $curtime['0'] . '.') . substr ($_FILES['image']['type'], 6)))
      {
        unlink ($_FILES['image']['tmp_name']);
      }

      $SQL = '' . 'UPDATE ban_source SET
			active=\'' . $_POST['active'] . '\',
			imp_limit=\'' . $_POST['imp_limit'] . '\',
			image=\'' . $curtime['0'] . '.' . substr ($_FILES['image']['type'], 6) . ('' . '\',
			url=\'' . $_POST['url'] . '\'
			WHERE id=' . $_POST['id']);
    }
    else
    {
      $SQL = '' . 'UPDATE ban_source SET
			active=\'' . $_POST['active'] . '\',
			imp_limit=\'' . $_POST['imp_limit'] . '\',
			url=\'' . $_POST['url'] . '\'
			WHERE id=' . $_POST['id'];
    }

    if (!(mysql_query ($SQL)))
    {
      exit ('Query failedd');
      ;
    }

    echo '<B><FONT COLOR="white" STYLE="background-color:red;">&nbsp;Last Changes Saved!&nbsp;</FONT></B>';
  }

  echo '










';
  $SQL = '' . 'select * from ban_source WHERE id=' . $_GET['record'];
  if (!($result = mysql_query ($SQL)))
  {
    exit ('Query failed1');
    ;
  }

  $row = mysql_fetch_array ($result);
  echo '


<FORM ACTION="';
  echo $php_self;
  echo '" METHOD="post" ENCTYPE="multipart/form-data">

';
  echo $admin_Name;
  echo '&nbsp;';
  echo $row['name'];
  echo '
<BR><BR>

<IMG SRC="../../upload/banners/';
  echo $row['image'];
  echo '" BORDER=0>

<BR><BR>

';
  echo $admin_table5[2];
  echo ':&nbsp;';
  echo date ('d/m/y', $row['image']);
  echo '
<BR><BR>

';
  echo $admin_table5[3];
  echo ':&nbsp;<INPUT TYPE=radio NAME="active" VALUE="on" ';
  if ($row['active'] == 'on')
  {
    echo 'checked';
  }

  echo '>';
  echo $admin_On;
  echo '			<INPUT TYPE=radio NAME="active" VALUE="off" ';
  if ($row['active'] == 'off')
  {
    echo 'checked';
  }

  echo '>';
  echo $admin_Off;
  echo '
<BR><BR>

';
  echo $admin_Impression_Limit;
  echo '<BR>	
<INPUT TYPE="text" NAME="imp_limit" SIZE="20" Value="';
  echo $row['imp_limit'];
  echo '"> (0 ';
  echo $admin_means_unlimited_impressions;
  echo ')

<BR><BR>


';
  echo $admin_Destination_URL;
  echo '<BR>
<INPUT TYPE="text" NAME="url" SIZE="70" VALUE="';
  echo $row['url'];
  echo '">

<BR><BR>

';
  echo $admin_Banner_Image;
  echo '<BR>	
<INPUT TYPE="file" NAME="image" SIZE="50"><BR><BR>
		
<INPUT TYPE=hidden NAME="id" VALUE="';
  echo $row['id'];
  echo '">
<INPUT TYPE="submit" NAME="ban_upload" VALUE="';
  echo $admin_Modify;
  echo '">
<INPUT TYPE=button VALUE="';
  echo $admin_Go_back;
  echo '" onClick="window.location=\'add.php\'">
</FORM>




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