Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Pessoal, estou com problema na hora de editar o nome, email e senha
A senha diz que está inválida, mesmo colocando a senha certa
O email e o nome diz que foi alterado, mas não muda no banco:
nome.php
<?php
$id_empresa = $_SESSION["session_id_empresa"];
$id_operador = $_SESSION["session_id_operador"];
$sql = $db->query( "select * from ".OPERADOR."
where id_operador = '$id_operador'");
$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" />
<title><?php echo TITLE; ?></title>
<link href="../../css/stilos.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
function sendForm(){
if (valida_camposArray(Array("nome","telefone","email","login","senha","resenha"),Array("Nome","Telefone","E-mail","Login","Senha","Repita Senha")))
document.forms[0].submit();
}
</script>
</head>
<body>
<div id="all">
<div id="topo">
<div id="topo">
<?php include "../comuns/topo.php"; ?>
</div>
</div>
<div id="conteudo">
<div id="meio">
<form action="funcoes.php" method="post" enctype="application/x-www-form-urlencoded" name="form1" id="form1">
<div class="content-titulo icon-titulo titulo-configuracao">Configuração do Operador! </div>
<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="botao01" onclick="return Envia()" value="Salvar" />
<input name="button3" type="button" class="botao01" onclick="cancelar()" value="Limpar" /></td>
</tr>
</table></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</body>
</html>
senha.php
<?php
$id_operador = $_SESSION["session_id_operador"];
$sql = $db->query( "select * from ".OPERADOR."
where id_operador = '$id_operador'");
$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" />
<title><?php echo TITLE; ?></title>
<link href="../../css/stilos.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
function sendForm(){
if (valida_camposArray(Array("senha_atual","senha","resenha"),Array("Senha Atual","Nova Senha","Confirmar nova senha"))){
if (checkForm())
document.forms[0].submit();
}
}
</script>
</head>
<body>
<div id="all">
<div id="topo">
<?php include "../comuns/topo.php"; ?>
</div>
<div id="conteudo">
<div id="meio">
<form action="funcoes.php" method="post" enctype="application/x-www-form-urlencoded" name="form1" id="form1">
<div class="content-titulo icon-titulo titulo-senha">Alterar Senha </div>
<div id="meio_exame">
<input type="hidden" name="op" value="2">
Para redefinir a sua senha, forneça a senha atual.
<input name="id_operador" type="hidden" id="id_operador" value="<?php echo $id_operador;?>" />
<br>
<table width="99%" border="0" cellpadding="1" cellspacing="2" bordercolor="#999999" class="tab2" id="l1">
<tr>
<td colspan="2"><div align="center"><?php echo "<font color=red>".$_GET["msg"]."</font>"?> </div></td>
</tr>
<tr>
<td width="27%" class="td01">Senha Atual: </td>
<td width="73%" class="td08" >
<input name="senha_atual" type="password" class="input2" id="senha_atual" size="12"></td>
</tr>
<tr>
<td class="td01">Nova senha:</td>
<td class="td08" >
<input name="senha" type="password" class="input2" id="senha" size="12">
<a href="#" onClick="janelaCenter('../../../comuns/dica_senha.htm','Planilha','scrollbars=yes','600','560')">Dicas de Segurança </a></td>
</tr>
<tr>
<td class="td01">Confirmar nova senha: </td>
<td class="td08" >
<input name="resenha" type="password" class="input2" id="resenha" onChange="Enviar()" size="12"></td>
</tr>
<tr>
<td colspan="2" align="left" ><input name="button" type="button" class="botao01" onclick="return Envia()" value="Salvar" />
<input name="button" type="button" class="botao01" onclick="cancelar()" value="Limpar" /></td>
</tr>
</table>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
funcoes.php
<?php
echo '<script language="JavaScript" src="../../js/funcoes.js"></script>';
$dados = array ($_POST['nome'],$_POST['codigo'],$_POST['endereco'],
$funcao->data($_POST['data_nasc']),$_POST['bairro'],
$_POST['cidade'],$_POST['id_estado'],$_POST['cep'],$_POST['telefone'],
$_POST['celular'],$_POST['email'],$_POST['status'],date('Y-m-d'),
$_POST['usuario'],md5($_POST['senha']),md5($_POST['senha_atual']));
$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 = '$dados[0]' ,
email = '$dados[10]'
where id_operador = '$id_operador'
");
echo "<script>msgRetorno('Registro alterado com sucesso!','configuracao.php?id=".$_POST['id_operador']."')</script>";
break;
case 2: // Alterar a Senha
$sql = $db->query( "select * from ".OPERADOR."
where id_operador = '$id_operador'
and senha = '$dados[15]'");
if ($db->rows($sql)){
$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...