Viewing File: /home/cienp/public_html/portal/sql_almx_cond.php

<?
    $dt_atua = date("Y-m-d");
    echo ".";

    switch ($_POST[opc]){
        case "ins":

            require "$this->include_dir/conecta.php";

            $s_de_cond = protecao($_POST[de_cond]);

            $sql  = "INSERT INTO ".$pref_tabl."almx_cond ";
            $sql .= "(de_cond, dt_cads, id_cads) ";
            $sql .= "VALUES ('$s_de_cond', '$dt_atua', $linhau[id_user])";
            #echo $sql;
            $res  = mysqli_query($conn, $sql);
            
            if ($res) {
                $onde = "index1.php?pg=ins_almx_cond&certo=S";
            } else
                $onde = "index1.php?pg=ins_almx_cond&certo=N";

        break;

        case "alt":

            $erros = 0;

            require "$this->include_dir/conecta.php";

            if ($erros == 0) {

                $s_de_cond = protecao($_POST[de_cond]);
                $s_fl_atvo = protecao($_POST[fl_atvo]);
                $s_id_cond = protecao($_POST[id_cond],'inteiro');

                $sql  = "UPDATE ".$pref_tabl."almx_cond ";
                $sql .= "SET de_cond = '$s_de_cond', ";
                $sql .= "id_altr = '$linhau[id_user]', ";
                $sql .= "dt_altr = '$dt_atua', ";
                $sql .= "fl_atvo = '$s_fl_atvo' ";
                $sql .= "WHERE id_cond = $s_id_cond ";
                $sql .= "LIMIT 1";
                $res  = mysqli_query($conn, $sql);

                if ($res) {
                    $onde = "index1.php?pg=alt_almx_cond&certo=S";
                } else
                    $onde = "index1.php?pg=alt_almx_cond&certo=N";
            }

        break;
        
    }
?>
<form name="retorna" method="post" action="">
    <input type="hidden" name="id_cond" id="id_cond" value="<?=$_POST[id_cond]?>">
    <input type="hidden" name="v_de_cond" id="v_de_cond" value="<?=$_POST[v_de_cond]?>">
    <input type="hidden" name="v_fl_atvo" id="v_fl_atvo" value="<?=$_POST[v_fl_atvo]?>">
    <input name="passa" type="hidden" id="passa" value="yes">
</form>
<?
echo "<SCRIPT LANGUAGE=javascript> \n";
echo "document.retorna.action = '$onde'; \n";
echo "document.retorna.submit(); \n";
echo "</script>";
?>
Back to Directory File Manager