Viewing file: conta_gravaImg.php (1.69 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
header("Content-Type: text/html; charset=utf-8",true);
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Data já vencida
include("../../config/config.php");
include(INCLUDES . "inc_Funcoes.php");
include(INCLUDES . "inc_Conexao.php");
include(INCLUDES . "valida_usuario.inc.php");
extract($_POST);
$irPara = base64_decode($chamou);
$hoje=date('Y-m-d');
$idCon = $CON_RowID;
$conta->CON_RowID = $CON_RowID;
$documento = $_FILES['CON_ImgDoc'];
if ($documento['name'] != '') {
$sqlMax = "
SELECT MAX(CON_RowID + 1)as CON_RowID
FROM FUN_ContasInternas
limit 1";
$max = executa($sqlMax);
foreach($max as $max1) {
$nome = $max1['CON_RowID'];
}
$extensao = strtolower(end(explode(".", $documento['name'])));
$imgDocumento = $nome.'.'.$extensao;
$caminho_imagem = "documentos/" . $imgDocumento;
move_uploaded_file($documento["tmp_name"], $caminho_imagem);
$conta->CON_ImgDoc = $imgDocumento;
}
mysql_query("BEGIN");
if (salva("FUN_ContasInternas",$conta)) {
$erro = false;
if ($idCon == '')
$idCon = mysql_insert_id();
} else {
$erro = true;
echo mysql_error();
}
if ($erro) {
mysql_query("ROLLBACK");
$msg = 'Problema para alterar a Conta! Por favor, tente novamente!';
} else {
mysql_query("COMMIT");
$msg = 'Conta alterada com SUCESSO!';
}
?>
<script type="text/javascript">
alert('<?= $msg?>');
if ('<?= !$erro?>') {
parent.location = "<?= $irPara?>";
} else {
parent.location = history.go(-1);
}
</script>
|