Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá, pessoal, estou com erro ao editar nome, e-mail e senha, simplesmente não altera:
<?php
$id_operador = $_SESSION["session_id_operador"];
$nome = $_SESSION["session_nome"];
$email = $_SESSION["session_email"];
$sql = $db->query( "select * from ".OPERADOR."
where id_operador = '$id_operador'
and nome = '$nome'
and email = '$email'");
$dados = $db->fetch($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<div id="all">
<div id="topo">
<div id="topo">
</div>
</div>
<div id="conteudo">
<div id="meio">
<form action="function.php" method="post" enctype="application/x-www-form-urlencoded" name="form1" id="form1">
<div id="meio_exame">
<table width="95%" border="0" cellpadding="0" cellspacing="0" bordercolor="#999999" class="tab2" id="l2" >
<tr>
<td width="100%"><table width="99%" border="0" cellpadding="1" cellspacing="2" bordercolor="#999999" class="tab2" id="l1">
<tr>
<td width="12%" height="25" class="td01">Nome:</td>
<td width="88%" height="25" class="td08"><input name="nome" type="text" class="input2" id="nome" value="<?php echo $dados['nome'] ?>" size="30" maxlength="80" /></td>
</tr>
<tr>
<td height="25" class="td01">Email:</td>
<td height="25" class="td08"><input name="email" type="text" class="input2" id="email" value="<?php echo $dados['email'] ?>" size="45" maxlength="80" />
<input name="op" type="hidden" id="op" value="1" /></td>
</tr>
<tr>
<td colspan="2"><input name="button3" type="button" class="botao" onclick="return Envia()" value="Salvar" />
<input name="button3" type="button" class="botao" onclick="cancelar()" value="Limpar" /></td>
</tr>
</table></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</body>
</html>
functon.php
<?php
$dados = array ($_POST['nome'],$_POST['codigo'],$_POST['id_empresa'],
$funcao->data($_POST['data_nascimento']),
$_POST['telefone'], $_POST['celular'],$_POST['email'],
$_POST['status'],date('Y-m-d'),
$_POST['usuario'],md5($_POST['senha_atual']),md5($_POST['senha']));
$id_empresa = $_SESSION["session_id_empresa"];
$id_operador = $_SESSION["session_id_operador"];
$op = $_POST['op'];
if ($op) {
switch($op){
case 1:
$sql = $db->query( "update ".OPERADOR." set
nome = '".$_REQUEST['nome']."' ,
email = '".$_REQUEST['email']."'
where id_operador = '".$id_operador."'");
echo $query;
break;
case 2: // Alterar a Senha
$rows = $db->rows($db->query( "select * from ".OPERADOR."
where id_operador = '$id_operador'
and senha = '$dados[15]'"));
if ($rows){
$sql = $db->query( "update ".OPERADOR." set
senha = '$dados[14]'
where id_operador = '$id_operador'");
echo "<script>msgRetorno('Registro alterado com sucesso!','alt_senha.php')</script>";
} else {
die("<script>location.replace('alt_senha.php?msg=Senha atual nao confere!')</script>");
}
break;
}// fim do switch
} else {
echo "<script>msgRetorno('Opcao invalida!','index.php')</script>";
}
?>Carregando comentários...