<?php
  ///////////////////////////////////////////////////
  //2007 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if (is_file ("../lang/".$lang."/".$lang.".php")) include "../lang/".$lang."/".$lang.".php";
     else include "../lang/ru/ru.php";

  $title=$titlepage = $TEXT['global-title5'];
  $helppage = "";

  require_once "../config.php";
  require_once "../util/top_layer1.php";

  if($result2['master'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['manager'] == 1) puterror2($TEXT['error-loginform4']);

  if(empty($_POST['mer_id'])) puterror2($TEXT['error-pho15']);
  if(empty($_POST['photo_id'])) puterror2($TEXT['error-pho17']);
  if(strlen($_POST['mer_id'])>11) puterror2($TEXT['error-pho13']);
  if(strlen($_POST['photo_id'])>11) puterror2($TEXT['error-pho18']);
  if(strlen($_POST['old_mer_id'])>11) puterror2($TEXT['error-pho21']);
  $_POST['mer_id'] = rep($_POST['mer_id']);
  $_POST['photo_id'] = rep($_POST['photo_id']);
  $_POST['old_mer_id'] = rep($_POST['old_mer_id']);

    $query = "UPDATE `tbl_photo` SET `mer_id` = '".$_POST['mer_id']."' WHERE `photo_id`='".$_POST['photo_id']."' ";
       if(mysql_query($query))
         {
         echo "<html><head>
               <meta HTTP-EQUIV='Refresh' CONTENT='0; URL=deleteform.php?mer_id=".$_POST['old_mer_id']."' />
               </head></html>";
         } else puterror2($TEXT['error-association']);
  require_once "../util/bottom.php";
?>
