<?
   session_start();
   if (!isset($_SESSION['cod_rentacar']))
      header("location: login.php");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Grupos</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META NAME="Generator" CONTENT="NetObjects Fusion 8 for Windows">
<link rel="stylesheet" href="../assets/clases.css" type="text/css" />
<script language="javascript" src="../assets/help_functions.js"></script>
<SCRIPT>
<!--
var F_A,F_B,F_CH,F_CL,F_DB,F_E,F_F,F_L,F_MT,F_MV,F_R,F_SE,F_SU,F_U,F_HR,F_MU,F_MD;
function F_e(){} function F_n(){} function F_onLoaded(){}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
document.write("<SCRIPT SRC=\"../assets/script.js\"><\/SCRIPT>");
document.write("<SCRIPT SRC=\"../assets/effects.js\"><\/SCRIPT>");
//-->
</SCRIPT>
<SCRIPT>
<!--
function F_doLoaded() {
	document.main = new F_cMain();
	document.objectModel = new Object();
	F_OM('Layout','LayoutLYR', 'doc', '', new Array());
	F_OM('ID_btBack' , '', 'btn', 'Layout',new Array(
	'Clicked',F_functID_btBackAction0,'','',0),'LayoutRegion3FORM',0,'btBack');
	F_pageLoaded('Layout');
}
function F_functID_btBackAction0(params) {
history.back();
}

//-->
</SCRIPT>
<LINK REL=STYLESHEET TYPE="text/css" HREF="../html/style.css">
<LINK REL=STYLESHEET TYPE="text/css" HREF="../html/site.css">
<STYLE>
</STYLE><NOLAYER>
<STYLE ID="NOF_STYLE_SHEET">
<!--
DIV#LayoutLYR { position:relative; top:0; left:0; z-index: 1; visibility:inherit; }
-->
</STYLE>

</NOLAYER>
</HEAD>
<BODY NOF="(MB=(save, 213, 65, 0, 0), L=(grupos2Layout, 760, 310))" STYLE="text-align: center;" onLoad="F_onLoaded();">
    <DIV ID="LayoutLYR"><LAYER ID="LayoutLYR" TOP=0 LEFT=0 VISIBILITY=INHERIT WIDTH=760 HEIGHT=588 Z-INDEX=1>
    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 NOF=LY>
        <TR VALIGN=TOP ALIGN=LEFT>
            <TD WIDTH=760>
                <TABLE ID="Table1" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" HEIGHT=213>
                    <TR HEIGHT=41>
                        <TD WIDTH=760 STYLE="background-color: rgb(255,255,255); background-image: none;">
                            <P>
                                <TABLE WIDTH=760 BORDER=0 CELLSPACING=0 CELLPADDING=0 ALIGN=LEFT NOF=TE>
                                    <TR>
                                        <TD>
                                            <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=760 HEIGHT=41 NOF="LayoutRegion1">
                                                <TR ALIGN=LEFT VALIGN=TOP>
                                                    <TD>
                                                        <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=735 NOF="LayoutRegion1">
                                                            <TR VALIGN=TOP ALIGN=LEFT>
                                                                <TD>
                                                                    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=425 NOF="LayoutRegion1">
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD WIDTH=409 HEIGHT=16><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=409 HEIGHT=1 BORDER=0 ALT=""></TD>
                                                                            <TD></TD>
                                                                        </TR>
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD HEIGHT=15></TD>
                                                                            <TD WIDTH=16><IMG ID="Picture2" HEIGHT=15 WIDTH=16 SRC="../assets/images/ihhomicon.jpg" BORDER=0 ALT="ihhomicon" TITLE="ihhomicon"></TD>
                                                                        </TR>
                                                                    </TABLE>
                                                                </TD>
                                                                <TD>
                                                                    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=56 NOF="LayoutRegion1">
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD WIDTH=2 HEIGHT=17><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=2 HEIGHT=1 BORDER=0 ALT=""></TD>
                                                                            <TD WIDTH=54><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=54 HEIGHT=1 BORDER=0 ALT=""></TD>
                                                                        </TR>
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD></TD>
                                                                            <TD WIDTH=54 CLASS="TextObject">
                                                                                <P><B><U><SPAN STYLE="font-size: 10px;">Home</SPAN></U></B></P>
                                                                            </TD>
                                                                        </TR>
                                                                    </TABLE>
                                                                </TD>
                                                                <TD>
                                                                    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=21 NOF="LayoutRegion1">
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD WIDTH=5 HEIGHT=16><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=5 HEIGHT=1 BORDER=0 ALT=""></TD>
                                                                            <TD></TD>
                                                                        </TR>
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD HEIGHT=15></TD>
                                                                            <TD WIDTH=16><IMG ID="Picture3" HEIGHT=15 WIDTH=16 SRC="../assets/images/ihemail.jpg" BORDER=0 ALT="ihemail" TITLE="ihemail"></TD>
                                                                        </TR>
                                                                    </TABLE>
                                                                </TD>
                                                                <TD>
                                                                    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=84 NOF="LayoutRegion1">
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD WIDTH=2 HEIGHT=17><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=2 HEIGHT=1 BORDER=0 ALT=""></TD>
                                                                            <TD WIDTH=82><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=82 HEIGHT=1 BORDER=0 ALT=""></TD>
                                                                        </TR>
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD></TD>
                                                                            <TD WIDTH=82 CLASS="TextObject">
                                                                                <P><B><U><SPAN STYLE="font-size: 10px;">Contacte-nos</SPAN></U></B></P>
                                                                            </TD>
                                                                        </TR>
                                                                    </TABLE>
                                                                </TD>
                                                                <TD>
                                                                    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=24 NOF="LayoutRegion1">
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD WIDTH=7 HEIGHT=15><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=7 HEIGHT=1 BORDER=0 ALT=""></TD>
                                                                            <TD></TD>
                                                                        </TR>
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD HEIGHT=17></TD>
                                                                            <TD WIDTH=17><IMG ID="Picture7" HEIGHT=17 WIDTH=17 SRC="../assets/images/ihgobutton03.jpg" BORDER=0 ALT="ihgobutton03" TITLE="ihgobutton03"></TD>
                                                                        </TR>
                                                                    </TABLE>
                                                                </TD>
                                                                <TD>
                                                                    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=44 NOF="LayoutRegion1">
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD WIDTH=6 HEIGHT=17><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=6 HEIGHT=1 BORDER=0 ALT=""></TD>
                                                                            <TD WIDTH=38><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=38 HEIGHT=1 BORDER=0 ALT=""></TD>
                                                                        </TR>
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD></TD>
                                                                            <TD WIDTH=38 CLASS="TextObject">
                                                                                <P><B><U><SPAN STYLE="color: rgb(255,102,0);">Ajuda</SPAN></U></B></P>
                                                                            </TD>
                                                                        </TR>
                                                                    </TABLE>
                                                                </TD>
                                                                <TD>
                                                                    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=29 NOF="LayoutRegion1">
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD WIDTH=22 HEIGHT=21><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=22 HEIGHT=1 BORDER=0 ALT=""></TD>
                                                                            <TD></TD>
                                                                        </TR>
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD HEIGHT=5></TD>
                                                                            <TD WIDTH=7><IMG ID="Picture8" HEIGHT=5 WIDTH=7 SRC="../assets/images/ihbullet.jpg" BORDER=0 ALT="ihbullet" TITLE="ihbullet"></TD>
                                                                        </TR>
                                                                    </TABLE>
                                                                </TD>
                                                                <TD>
                                                                    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=52 NOF="LayoutRegion1">
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD WIDTH=3 HEIGHT=17><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=3 HEIGHT=1 BORDER=0 ALT=""></TD>
                                                                            <TD WIDTH=49><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=49 HEIGHT=1 BORDER=0 ALT=""></TD>
                                                                        </TR>
                                                                        <TR VALIGN=TOP ALIGN=LEFT>
                                                                            <TD></TD>
                                                                            <TD WIDTH=49 CLASS="TextObject">
                                                                                <P><B><SPAN STYLE="font-size: 10px;" class="link_azul"><A HREF="./logout.php">Sair</A></SPAN></B>&nbsp;</P>
                                                                            </TD>
                                                                        </TR>
                                                                    </TABLE>
                                                                </TD>
                                                            </TR>
                                                        </TABLE>
                                                    </TD>
                                                </TR>
                                            </TABLE>
                                        </TD>
                                    </TR>
                                </TABLE>
                            </P>
                        </TD>
                    </TR>
                    <TR HEIGHT=137>
                        <TD>
                            <P><IMG ID="Banner2" HEIGHT=137 WIDTH=760 SRC="../assets/images/autogen/Grupos_NDefault.jpg" VSPACE=0 HSPACE=0 ALIGN="TOP" BORDER=0 ALT="Grupos" TITLE="Grupos" NOF=B_H></P>
                        </TD>
                    </TR>
                    <TR HEIGHT=34>
                        <TD STYLE="background-color: rgb(255,255,255); background-image: url('../assets/images/ihnavbg.jpg');">
                            <H1 STYLE="text-align: center;"><SPAN STYLE="font-size: x-small; font-weight: normal;"></SPAN></TD>
                    </TR>
                    <TR HEIGHT=1>
                        <TD STYLE="background-color: rgb(255,255,255); background-image: url('../assets/images/ihtop3.gif');">
                            <P></P>
                        </TD>
                    </TR>
                </TABLE>
            </TD>
        </TR>
    </TABLE>
    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=760 NOF=LY>
        <TR VALIGN=TOP ALIGN=LEFT>
            <TD HEIGHT=310 WIDTH=760>
                <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=760 HEIGHT=310 STYLE="background-color: rgb(237,237,237);" NOF="LayoutRegion3">
                    <TR ALIGN=LEFT VALIGN=TOP>
                        <TD>
                            <FORM NAME="LayoutRegion3FORM" ACTION="" METHOD=POST>
                                <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=704 NOF="LayoutRegion3">
                                    <TR VALIGN=TOP ALIGN=LEFT>
                                        <TD WIDTH=98 HEIGHT=18><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=98 HEIGHT=1 BORDER=0 ALT=""></TD>
                                        <TD WIDTH=606><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=606 HEIGHT=1 BORDER=0 ALT=""></TD>
                                    </TR>
                                    <TR VALIGN=TOP ALIGN=LEFT>
                                        <TD></TD>
                                        <TD WIDTH=606 CLASS="TextObject">
                                            <P><?

    if ($_SERVER['REQUEST_METHOD'] == "POST") 
    {      
       include('main.php');
       include('../assets/ftpfunc.php');

       db_connect();
       $sql = "select codigo, cod_grupo from tr_rentacar_grupos where cod_rentacar=".$_SESSION['cod_rentacar'];
       $result = mysql_query($sql);       
       
       $mensagem1='';
       while($row = mysql_fetch_row($result))
       {      
           $codigo                 = $row[0];
           $var_text_grupo         = $row[1];
           $funcao                 = 'funcao'.$codigo;
           $del_foto               = 'del_foto'.$codigo;
           $num_categoria          = 'num_categoria'.$codigo;           
           $text_desc              = 'text_desc'.$codigo;
           $text_desc_longa        = 'text_desc_longa'.$codigo;
           $text_desc_pt           = 'text_desc_pt'.$codigo;
           $text_desc_longa_pt     = 'text_desc_longa_pt'.$codigo;
           $text_desc_de           = 'text_desc_de'.$codigo;
           $text_desc_longa_de     = 'text_desc_longa_de'.$codigo;
           $text_desc_fr           = 'text_desc_fr'.$codigo;
           $text_desc_longa_fr     = 'text_desc_longa_fr'.$codigo;
          
           $path_foto              = 'path_foto'.$codigo;
           $hidden_foto_grupo      = 'hidden_foto_grupo'.$codigo;
           $text_sipp              = 'text_sipp'.$codigo;           
                       
           $var_num_categoria      = $_POST[$num_categoria];                    
           $var_text_desc          = $_POST[$text_desc];
           $var_text_desc_longa    = $_POST[$text_desc_longa];
           $var_text_desc_pt       = $_POST[$text_desc_pt];
           $var_text_desc_longa_pt = $_POST[$text_desc_longa_pt];
           $var_text_desc_de       = $_POST[$text_desc_de];
           $var_text_desc_longa_de = $_POST[$text_desc_longa_de];
           $var_text_desc_fr       = $_POST[$text_desc_fr];
           $var_text_desc_longa_fr = $_POST[$text_desc_longa_fr];
           
           $var_text_sipp          = $_POST[$text_sipp];

           if ($_POST[$funcao]==1 and $var_text_desc!='' and $var_text_desc_longa!='' and $var_text_sipp!='')
           {
              $sql = "update tr_rentacar_grupos set ";
              $sql = $sql." cod_categoria=$var_num_categoria, ";
              $sql = $sql." descricao='$var_text_desc', ";
              $sql = $sql." descricao_longa='$var_text_desc_longa', ";
              $sql = $sql." SIPP='$var_text_sipp', ";
              $sql = $sql." descricao_pt='$var_text_desc_pt', ";
              $sql = $sql." descricao_longa_pt='$var_text_desc_longa_pt', ";
              $sql = $sql." descricao_de='$var_text_desc_de', ";
              $sql = $sql." descricao_longa_de='$var_text_desc_longa_de', ";
              $sql = $sql." descricao_fr='$var_text_desc_fr', ";
              $sql = $sql." descricao_longa_fr='$var_text_desc_longa_fr' ";
              $sql = $sql." where cod_rentacar = ".$_SESSION['cod_rentacar'];
              $sql = $sql." and codigo = ".$codigo;
                            
              $result1 = mysql_query($sql);               
              if ($result1=='')
                 $mensagem1=$mensagem1."Ocorreu um erro na actualização do grupo ".$var_text_grupo."<br>";                  
              else
                 $mensagem1=$mensagem1."Os dados do grupo ".$var_text_grupo." foram actualizados com sucesso<br>";
           }           
           if ($_POST[$funcao]<>-1 and $_FILES[$path_foto]['name'] !="" and !(isset($_POST[$del_foto])))
           {           
               $filesize = filesize($_FILES[$path_foto]['tmp_name']); 
               if ($filesize >= 51200)
               { 
                   echo "<BR><P STYLE='text-align: justify;'><B><SPAN STYLE='font-family: 

Verdana,Tahoma,Arial,Helvetica,Sans-serif; font-size: xx-small;'>The size of the file ".$_FILES[$path_foto]['name']." is 

".$filesize." bytes.<br>This filesize is too large.<br>It must be less than 50KB or 51200 bytes."."</SPAN></B></P>";
               }
               else
               { 
                   $foto = $_FILES[$path_foto]['name'];    
                   SubirArquivo($_POST["pasta"],$_FILES[$path_foto]['tmp_name'],$foto);     

                   $sql = "update tr_rentacar_grupos set ";
                   $sql = $sql." foto_grupo ='$foto' ";
                   $sql = $sql." where cod_rentacar = ".$_SESSION['cod_rentacar'];
                   $sql = $sql." and codigo = ".$codigo;
                            
                   $result1 = mysql_query($sql);               
                   if ($result1=='')
                       $mensagem1=$mensagem1."Ocorreu um erro na actualização da foto do grupo ".$var_text_grupo."<br>";                  
                   else
                       $mensagem1=$mensagem1."A foto do grupo ".$var_text_grupo." foi actualizada com sucesso<br>";                          
               }
           }
           
           if ($_POST[$funcao]==-1)
           {
              $sql = "delete from tr_rentacar_grupos where cod_rentacar = ".$_SESSION['cod_rentacar'];
              $sql = $sql." and codigo = ".$codigo;
          
              $result2 = mysql_query($sql);
              if ($result2=='')
                 $mensagem1=$mensagem1."Ocorreu um erro eliminando o grupo ".$var_text_grupo."<br>";                  
              else
                 $mensagem1=$mensagem1."O grupo ".$var_text_grupo." foi eliminado com sucesso<br>";

              if ($result2!='')
              {
                  if ($_POST[$hidden_foto_grupo]!='')
                  {                 
                      ApagarArquivo($_POST["pasta"],$_POST[$hidden_foto_grupo]); 
                  }
              }

              $sql = "delete from tr_rentacar_extras_values where cod_rentacar = ".$_SESSION['cod_rentacar'];
              $sql = $sql." and cod_grupo = '".$var_text_grupo."'";
              
              $result2 = mysql_query($sql);  

              $sql = "delete from tr_rentacar_tarifas_precos where cod_rentacar = ".$_SESSION['cod_rentacar'];
              $sql = $sql." and cod_grupo = '".$var_text_grupo."'";
              
              $result2 = mysql_query($sql);     

              $sql = "delete from tr_rentacar_dispon where cod_rentacar = ".$_SESSION['cod_rentacar'];
              $sql = $sql." and cod_grupo = '".$var_text_grupo."'";
              
              $result2 = mysql_query($sql);   
           }

           if ($_POST[$funcao]<>-1 and isset($_POST[$del_foto]) and $_POST[$hidden_foto_grupo]!='')
           {           
              ApagarArquivo($_POST["pasta"],$_POST[$hidden_foto_grupo]); 
              $sql = "update tr_rentacar_grupos set foto_grupo = '' ";
              $sql = $sql." where cod_rentacar = ".$_SESSION['cod_rentacar'];
              $sql = $sql." and codigo = ".$codigo;
          
              $result2 = mysql_query($sql);
              if ($result2=='')
                 $mensagem1=$mensagem1."Ocorreu um erro eliminando a foto do grupo ".$var_text_grupo."<br>";                  
              else
                 $mensagem1=$mensagem1."A foto do grupo ".$var_text_grupo." foi eliminada com sucesso<br>";
           }
       }

       if (isset($_POST['new_check']))
       {
          $new_group_type         = $_POST['new_group_type'];
          $new_group_code         = $_POST['new_group_code'];
          $new_sipp               = $_POST['new_sipp_code'];
          $new_desc_group         = $_POST['new_desc_group'];
          $new_desc_long_group    = $_POST['new_desc_long_group'];
          $new_desc_group_pt      = $_POST['new_desc_group_pt'];
          $new_desc_long_group_pt = $_POST['new_desc_long_group_pt'];
          $new_desc_group_de      = $_POST['new_desc_group_de'];
          $new_desc_long_group_de = $_POST['new_desc_long_group_de'];
          $new_desc_group_fr      = $_POST['new_desc_group_fr'];
          $new_desc_long_group_fr = $_POST['new_desc_long_group_fr'];

          $sql = "select * from tr_rentacar_grupos where trim(cod_grupo) = "."'$new_group_code' and cod_rentacar=".$_SESSION['cod_rentacar'];
          
          $result = mysql_query($sql) or die("select tr_rentacar_grupos fails");
          $num_row = mysql_num_rows($result);
                    
          if ($num_row!=0)
          {
             echo '<P STYLE="text-align: justify;"><B><SPAN STYLE="font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif; font-size: xx-small;">Já existe o código de grupo '.$new_group_code.'.  Por favor escolha outro código e tente novamente!</SPAN></B></P>';             
          }  
          else
          {  
             $sql = "insert into tr_rentacar_grupos (cod_rentacar, cod_categoria, cod_grupo, descricao, descricao_longa, ";
             $sql = $sql." SIPP, descricao_pt, descricao_longa_pt, descricao_de, descricao_longa_de, ";
             $sql = $sql." descricao_fr, descricao_longa_fr) "; 
             $sql = $sql." values ";
             $sql = $sql." (".$_SESSION['cod_rentacar'].",$new_group_type,'$new_group_code',";
             $sql = $sql." '$new_desc_group','$new_desc_long_group','$new_sipp', ";
             $sql = $sql." '$new_desc_group_pt','$new_desc_long_group_pt',";
             $sql = $sql." '$new_desc_group_de','$new_desc_long_group_de',";
             $sql = $sql." '$new_desc_group_fr','$new_desc_long_group_fr')";
          
             $result3 = mysql_query($sql);
             if ($result3=='')
                 $mensagem1=$mensagem1."Ocorreu um erro na inserção do grupo ".$new_group_code."<br>";                  
             else
                 $mensagem1=$mensagem1."A inserção do grupo ".$new_group_code." foi efectuada com sucesso<br>";
          
             if ($result3!='' and $_FILES['path_new_photo']['name'] !="")
             {       
                 $codigo = mysql_insert_id();    
                 $filesize = filesize($_FILES['path_new_photo']['tmp_name']); 
                 if ($filesize >= 51200)
                 { 
                     echo "<BR><P STYLE='text-align: justify;'><B><SPAN STYLE='font-family: 

Verdana,Tahoma,Arial,Helvetica,Sans-serif; font-size: xx-small;'>O tamanho do arquivo ".$_FILES['path_new_photo']['name']." é ".$filesize." bytes.<br>O tamanho do arquivo é muito grande.<br>Deve de ser menor a 50KB ou 51200 bytes."."</SPAN></B></P>";
                 }
                 else
                 { 
                     $foto = $_FILES['path_new_photo']['name'];    
                     SubirArquivo($_POST["pasta"],$_FILES['path_new_photo']['tmp_name'],$foto);     

                     $sql = "update tr_rentacar_grupos set ";
                     $sql = $sql." foto_grupo ='$foto' ";
                     $sql = $sql." where cod_rentacar = ".$_SESSION['cod_rentacar'];
                     $sql = $sql." and codigo = ".$codigo;
                            
                     $result1 = mysql_query($sql);               
                     if ($result1=='')
                         $mensagem1=$mensagem1."Ocorreu um erro na inserção da foto do grupo ".$new_group_code."<br>";                  
                     else
                         $mensagem1=$mensagem1."A inserção da foto do grupo ".$new_group_code." foi efectuada com sucesso<br>";   
                 }                       
             }  
          }
       }

       echo '<B><SPAN STYLE="font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif; font-size: 

xx-small;">'.$mensagem1.'</SPAN></B>';  
       
       db_disconnect();
    }

?>
&nbsp;</P>
                                        </TD>
                                    </TR>
                                </TABLE>
                                <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 NOF="LayoutRegion3">
                                    <TR VALIGN=TOP ALIGN=LEFT>
                                        <TD WIDTH=98 HEIGHT=10><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=98 HEIGHT=1 BORDER=0 ALT=""></TD>
                                        <TD></TD>
                                    </TR>
                                    <TR VALIGN=TOP ALIGN=LEFT>
                                        <TD></TD>
                                        <TD WIDTH=99>
                                            <TABLE ID="Table5" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" HEIGHT=31>
                                                <TR>
                                                    <TD>
                                                        <P><INPUT TYPE=BUTTON NAME="btBack" VALUE="Voltar" ID="ID_btBack" class="text_objects" onClick="return(F_e('ID_btBack', F_CL))"></P>
                                                    </TD>
                                                </TR>
                                            </TABLE>
                                        </TD>
                                    </TR>
                                </TABLE>
                            </FORM>
                        </TD>
                    </TR>
                </TABLE>
            </TD>
        </TR>
        <TR VALIGN=TOP ALIGN=LEFT>
            <TD HEIGHT=65 WIDTH=760>
                <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=760 HEIGHT=65 STYLE="background-color: rgb(0,51,102);" NOF="LayoutRegion6">
                    <TR ALIGN=LEFT VALIGN=TOP>
                        <TD>
                            <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=564 NOF="LayoutRegion6">
                                <TR VALIGN=TOP ALIGN=LEFT>
                                    <TD WIDTH=212 HEIGHT=28><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=212 HEIGHT=1 BORDER=0 ALT=""></TD>
                                    <TD WIDTH=352><IMG SRC="../assets/images/autogen/clearpixel.gif" WIDTH=352 HEIGHT=1 BORDER=0 ALT=""></TD>
                                </TR>
                                <TR VALIGN=TOP ALIGN=LEFT>
                                    <TD></TD>
                                    <TD WIDTH=352 CLASS="TextObject">
                                        <P STYLE="text-align: center;"><B><SPAN STYLE="color: rgb(255,255,255);">Copyright Bravacar 2006</SPAN></B></P>
                                    </TD>
                                </TR>
                            </TABLE>
                        </TD>
                    </TR>
                </TABLE>
            </TD>
        </TR>
    </TABLE>
    </LAYER></DIV>
</BODY>
</HTML>
 