Path: C:\
<?php
date_default_timezone_set('America/Sao_Paulo');
$dateadded = date("d-m-Y G:i");
$dateadded2 = date("Y-m-d G:i");
session_start();
include_once("seguranca.php");
include_once("conexao.php");
function getUserIP()
{
$client = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote = $_SERVER['REMOTE_ADDR'];
if(filter_var($client, FILTER_VALIDATE_IP))
{
$ip = $client;
}
elseif(filter_var($forward, FILTER_VALIDATE_IP))
{
$ip = $forward;
}
elseif(filter_var($remote, FILTER_VALIDATE_IP))
{
$ip = $remote;
}
else
{
$ip = 'Desconhecido';
}
return $ip;
}
$user_ip = getUserIP();
$id = $_POST["id"];
$nome = utf8_decode($_POST["nome"]);
$email = $_POST["email"];
$usuario = $_POST["usuario"];
$senha = $_POST["senha"];
$che0 = isset($_POST['Acesso0'])?$_POST['Acesso0']:'0';
$che1 = isset($_POST['Acesso1'])?$_POST['Acesso1']:'0';
$che2 = isset($_POST['Acesso2'])?$_POST['Acesso2']:'0';
$che3 = isset($_POST['Acesso3'])?$_POST['Acesso3']:'0';
$che4 = isset($_POST['Acesso4'])?$_POST['Acesso4']:'0';
$che5 = isset($_POST['Acesso5'])?$_POST['Acesso5']:'0';
$che6 = isset($_POST['Acesso6'])?$_POST['Acesso6']:'0';
$che7 = isset($_POST['Acesso7'])?$_POST['Acesso7']:'0';
$che8 = isset($_POST['Acesso8'])?$_POST['Acesso8']:'0';
$cus1 = isset($_POST['Custo1'])?$_POST['Custo1']:'0';
$cus2 = isset($_POST['Custo2'])?$_POST['Custo2']:'0';
$cus3 = isset($_POST['Custo3'])?$_POST['Custo3']:'0';
$query = mysqli_query($conn,"UPDATE usuarios SET
nome= '" . $nome . "' ,
email='" . $email. "' ,
login= '" . $usuario . "' ,
senha= '" . $senha . "' ,
acesso0= '" . $che0 . "',
acesso1= '" . $che1 . "',
acesso2= '" . $che2 . "',
acesso3= '" . $che3 . "',
acesso4= '" . $che4 . "',
acesso5= '" . $che5 . "',
acesso6= '" . $che6 . "',
acesso7= '" . $che7 . "',
acesso8= '" . $che8 . "',
custo1= '" . $cus1 . "',
custo2= '" . $cus2 . "',
custo3= '" . $cus3 . "',
alterado= '" . $dateadded2. "',
IPalterado= '".$user_ip."' WHERE id='" .$id."'" );
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
</head>
<body>
<?php
if ($query === TRUE){
echo "
<script type=\"text/javascript\">
alert(\"Usuário Alterado com Sucesso.\");
</script>
";
}
else{
echo "
<script type=\"text/javascript\">
alert(\"Alteração NÃO teve Sucesso.\");
</script>
";
}
if($_SESSION['acesso7'] == 1)
{echo "<script language='JavaScript'>window.location.href='main.php?link=4&id=$id'; </script>";}
else
{echo "<script language='JavaScript'>window.location.href='main.php?link=3&id=$id'; </script>";}
?>
</body>
</html>