| paytaly |
10-12-2009 09:18 PM |
Código PHP:
<?php include ("config/config.php"); include("config/botaodireito.php") ?> <script language="JavaScript"> <!-- Javascript que atualiza a imagem var URL = unescape(window.location.pathname);
function refresh() { window.location.href = URL; } //--> </script> <script type="text/JavaScript">
function isAlphaNumeric(value) { if (value.match(/^[a-zA-Z0-9]+$/)) return true; else return false; } function checkform(f) { if (f.nome_completo.value=="") { alert("Coloque seu NOME COMPLETO!"); return false; } if (f.login.value=="") { alert("Escolha um LOGIN!"); return false; } if (f.senha.value=="") { alert("Coloque uma SENHA!"); return false; } if (f.email.value=="") { alert("Coloque um E-MAIL!"); return false; } if (f.telefone.value=="") { alert("Coloque seu TELEFONE!"); return false; } if (f.pergunta_secreta.value=="") { alert("Escolha uma PERGUNTA SECRETA!"); return false; } if (f.resposta_secreta.value=="") { alert("Coloque uma RESPOSTA SECRETA!"); return false; } if (f.senha.value!=f.senha2.value) { alert("As duas senhas não estão IGUAIS!"); return false; } return true; } </script><head> <style type="text/css"> <!-- body { background-image: url(img/bg1.gif); } --> </style> <link href="css/cursor.css" rel="stylesheet" type="text/css" /> <link href="css/registre-se.css" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" href="css/favicon.ico" /> <title>Cadastro</title><style type="text/css"> <!-- a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: none; } a:active { text-decoration: none; } .style1 { font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; } .cima {font-size: 18px; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; } .style4 { color: #990000; font-weight: bold; font-size: 18px; font-family: Verdana, Arial, Helvetica, sans-serif; } </style> </head> <form method="post" action="registre-se.php" onsubmit="return checkform(this)"><center> <div align="center"><span class="style4">Registro de uma nova CONTA </span><br /> <br /> <br /> </div> <table> <tr> <td width="200"><div align="left" class="style1" id="tudo"> <div align="right">Nome Completo - </div> </div></td> <td width="144"><input type="text" name="nome_completo" id="nomecompleto" maxlength="80" size="20" /></td> </tr> <tr> <td><div align="left" class="style1" id="tudo"> <div align="right"> Login - </div> </div></td> <td><input type="text" name="login" id="login" maxlength="45" size="20" /></td> </tr> <tr> <td colspan="2" style="text-align: center;"> <p><br /> <span class="style1"><strong>Sua senha deve ser iniciada com uma letra e devera <br /> conter somente letras (minusculas) e numeros.</strong></span><br /> <br /> </p> </td> </tr> </table> <table> <tr> <td width="269" class="style1"><div id="div"align="left"> <div align="right">Senha - </div> </div></td> <td width="213"><input type="password" name="senha" id="senha" maxlength="45" size="20" /></td> </tr> <tr> <td class="style1"><div id="div"align="left"> <div align="right">Repita a senha - </div> </div></td> <td><input type="password" name="senha2" id="senha" maxlength="45" size="20" /></td> </tr> <tr> <td class="style1"><div id="div2"align="left"> <div align="right">E-Mail - </div> </div></td> <td><input type="text" name="email" id="email" maxlength="60" size="20" /></td> </tr> <tr> <td class="style1"><div id="div2"align="left"> <div align="right">Telefone - </div> </div></td> <td><input type="text" name="telefone" id="telefone" maxlength="20" size="20" /></td> </tr> <tr> <td colspan="2" style="text-align: center;"> <strong><br /> <span class="style1">Atenção com as perguntas e respostas secretas, pois são<br /> com elas que vocêconseguirá recuperar sua senha.</span><br /> <br /> </strong></td> </tr> </table> <table width="499"> <tr> <td width="272" class="style1"><div id="div2"align="left"> <div align="right">Pergunta SECRETA - </div> </div></td> <td width="215"><input type="text" name="pergunta_secreta" id="pergunta" maxlength="20" size="20" /></td> </tr> <tr> <td class="style1"><div id="div2"align="left"> <div align="right">Resposta da Pergunta SECRETA - </div> </div></td> <td><input type="text" name="resposta_secreta" id="resposta" maxlength="20" size="20" /></td> </tr> <tr> <td colspan="2" style="text-align: center;"><br /> <br /> <center><table width="275" border="0"> <tr> <td width="133"><div align="center"><input type="submit" name="submit" id="registrar" value="Registrar" /></div></td> <td width="132"><div align="center"><input type="reset" id="registrar" value="Limpar CAMPOS" /></div></td> </tr> </table></center> </td> </tr> </table> </center> </form>
<?php $falha = " <center><table class='falha' border='0'> <tr> <td width='30'><center><img src=\"img/falha.png\"></center></td> <td>Usuario <b>".$_POST['login']."</b> ou E-mail <b>".$_POST['email']."</b> ja existem.</td> </tr> </table></center> "; $sucesso = " <center><table class='sucesso' border='0'> <tr> <td width='30'><center><img src=\"img/sucesso.png\"></center></td> <td>Usuario <b>".$_POST['account']."</b> Registrado com Sucesso.</td> </tr> </table></center> ";
if( ereg("^([a-z0-9_-])*$", $_POST['nome_completo']) && ereg("^([a-z0-9_-])*$", $_POST['login']) && ereg("^([a-z0-9_-])*$", $_POST['senha']) && ereg("^([a-z0-9_-])*$", $_POST['email']) && ereg("^([a-z0-9_-])*$", $_POST['telefone']) && ereg("^([a-z0-9_-])*$", $_POST['pergunta_secreta']) && ereg("^([a-z0-9_-])*$", $_POST['resposta_secreta']) ) { if ($page="home.php" && $_POST['login'] && strlen($_POST['login'])<16 && strlen($_POST['login'])>3 && $_POST['senha'] && $_POST['senha2'] && $_POST['senha']==$_POST['senha2']) { $check=mysql_query("select * from accounts where login='".$_POST['login']."' or email='".$_POST['email']."'"); $check1=mysql_num_rows($check); if($check1>0) { echo $falha; } else { mysql_query("INSERT INTO accounts (nome_completo, login, password, access_level, email, telefone, pergunta, resposta) VALUES ('".$_POST['nome_completo']."', '".$_POST['login']."', '".base64_encode(pack('H*', sha1($_POST['senha'])))."', 0, '".$_POST['email']."', '".$_POST['telefone']."', '".$_POST['pergunta_secreta']."', '".$_POST['resposta_secreta']."')", $link); mysql_close($link); echo $sucesso; } } else { print '<p><b> </b></p>'.mysql_error(); } } else { echo "As limitações não foram testadas para a segurança. Se você for confiável que tido a informação correta, consultar por favor à administração. "; } ?>
Erro
Código:
else
{
{
mysql_query("INSERT INTO accounts (nome_completo, login, password, access_level, email, telefone, pergunta, resposta) VALUES ('".$_POST['nome_completo']."', '".$_POST['login']."', '".base64_encode(pack('H*', sha1($_POST['senha'])))."', 0, '".$_POST['email']."', '".$_POST['telefone']."', '".$_POST['pergunta_secreta']."', '".$_POST['resposta_secreta']."')", $link);
mysql_close($link);
echo $sucesso;
}
|