Esempio n. 1
0
<?php

ob_start();
@session_start();
require_once '../model/DB.php';
require_once '../util/util.php';
require_once '../util/email/config.php';
// salvar
//echo "controller: ".$_REQUEST['acao'];
$_REQUEST['p']['salario'] = str_replace(".", "", $_REQUEST['p']['salario']);
$_REQUEST['p']['salario'] = str_replace(",", ".", $_REQUEST['p']['salario']);
$_REQUEST['p']['data_admissao'] = convertDataMysql($_REQUEST['p']['data_admissao']);
if ($_REQUEST['acao'] == "Salvar") {
    if ($_REQUEST['id']) {
        if ($_REQUEST['objeto'] == "calculosbrasil") {
            DB::atualizarPeloCampo($_REQUEST['objeto'], $_REQUEST['p'], "id_usuario", $_REQUEST['id']);
        } else {
            DB::atualizar($_REQUEST['objeto'], $_REQUEST['p'], $_REQUEST['id']);
        }
        $msg = "ATUALIZADO COM SUCESSO";
        if ($_FILES['arquivo']['name']) {
            $ext = end(explode(".", $_FILES['arquivo']['name']));
            $id = $_REQUEST['id'];
            $nome = $_REQUEST['objeto'] . "_" . $id . "." . $ext;
            $dir = "../view/fotos/" . $nome;
            if (is_uploaded_file($_FILES['arquivo']['tmp_name'])) {
                if (move_uploaded_file($_FILES['arquivo']['tmp_name'], $dir)) {
                    $pp['foto'] = $nome;
                    DB::atualizar($_REQUEST['objeto'], $pp, $id);
                } else {
                    $msg = "ERRO NO ENVIO DO ARQUIVO!";
Esempio n. 2
0
<?php

ob_start();
@session_start();
require_once '../model/DB.php';
require_once '../util/util.php';
// salvar
//echo "controller: ".$_REQUEST['acao'];
if ($_REQUEST['acao'] == "Salvar") {
    $_REQUEST['p']['excluido'] = "N";
    $_REQUEST['p']['perfil'] = "ATLETA";
    $_REQUEST['p']['ativo'] = "S";
    if ($_REQUEST['p']['data_nascimento']) {
        //$_REQUEST['p']['data_nascimento'] = convertDataMysql($_REQUEST['p']['data_nascimento']);
    }
    if ($_REQUEST['p']['data']) {
        $_REQUEST['p']['data'] = convertDataMysql($_REQUEST['p']['data']);
    }
    if ($_REQUEST['p']['valor']) {
        $_REQUEST['p']['valor'] = str_replace(".", "", $_REQUEST['p']['valor']);
        $_REQUEST['p']['valor'] = str_replace(",", ".", $_REQUEST['p']['valor']);
    }
    //#####################################################################################################################################
    // ATUALIZA UM REGISTRO
    //#####################################################################################################################################
    if (DB::salvar("atleta", $_REQUEST['p'])) {
        $msg = "2";
    }
    header("location: ../pages/login.php?msg=" . $msg . "&" . $_REQUEST['retorno']);
}