Jump to content
Fórum Script Brasil
  • 0

Dados não retornam


Robson Oliveira

Question

Olá pessoal, boa noite!
Então eu tenho uma página de cadastro porém ela só retorna os dados para o meu banco de dados quando está em localhost, fui hospedar em uma hospedagem e o formulário não está registrando os dados dos usuários no banco de dados assim impossibilitando o login.

Página de cadastro :

 

<!DOCTYPE html>
<html lang="pt-br">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="NXTRADER">
    <link rel="icon" href="favicon.ico">

    <title>NXTRADER - Login</title>
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
    <link href="css/signin.css" rel="stylesheet">
    <script src="/js/ie-emulation-modes-warning.js"></script>
    <script src="js/pace.min.js"></script>
  
    
  </head>
  <script src="https://apps.elfsight.com/p/platform.js" defer></script>
<div class="elfsight-app-a9e67a34-8919-4194-b23a-d6dcb19b5e6a"></div>
  
	</body>
		<form class="form-signin" method="POST" action="processa_cad_usuario.php">
		<center><img src="https://i.imgur.com/ANDQ34w.png" height="150" width="150"></center>
        <h2 class="form-signin-heading"><p><span style="color:#D3D3D3">Crie sua conta agora mesmo!</span></p>
</h2>
			<input type="text" name="txt_nome_usuario" class="form-control" placeholder="Nome" required onchange="this.value = this.value.trim()"><br>
			<input type="text" name="txt_email_usuario" class="form-control" placeholder="Nome de Usuário" required onchange="this.value = this.value.trim()">
			<input type="password" name="txt_senha_usuario" class="form-control" placeholder="Senha" required onchange="this.value = this.value.trim()">
			<input class="btn btn-lg btn-danger btn-block" type="submit" value="Cadastrar">
			<a class="btn btn-lg btn-default btn-block" href="/index.php" role="button">Voltar ao Login</a>
		</form>
	</body>
</html>

Página aonde é processado o cadastro :
 

<!DOCTYPE html>
<html lang="pt-br">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="NXTRADER">
    <link rel="icon" href="favicon.ico">

    <title>NXTRADER - Login</title>
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
    <link href="css/signin.css" rel="stylesheet">
    <script src="/js/ie-emulation-modes-warning.js"></script>
    <script src="js/pace.min.js"></script>
  
    
  </head>
  <script src="https://apps.elfsight.com/p/platform.js" defer></script>
<div class="elfsight-app-a9e67a34-8919-4194-b23a-d6dcb19b5e6a"></div>
  <script type='text/javascript'>
    //<![CDATA[
    shortcut={all_shortcuts:{},add:function(a,b,c){var d={type:"keydown",propagate:!1,disable_in_input:!1,target:document,keycode:!1};if(c)for(var e in d)"undefined"==typeof c[e]&&(c[e]=d[e]);else c=d;d=c.target,"string"==typeof c.target&&(d=document.getElementById(c.target)),a=a.toLowerCase(),e=function(d){d=d||window.event;if(c.disable_in_input){var e;d.target?e=d.target:d.srcElement&&(e=d.srcElement),3==e.nodeType&&(e=e.parentNode);if("INPUT"==e.tagName||"TEXTAREA"==e.tagName)return}d.keyCode?code=d.keyCode:d.which&&(code=d.which),e=String.fromCharCode(code).toLowerCase(),188==code&&(e=","),190==code&&(e=".");var f=a.split("+"),g=0,h={"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"},i={esc:27,escape:27,tab:9,space:32,"return":13,enter:13,backspace:8,scrolllock:145,scroll_lock:145,scroll:145,capslock:20,caps_lock:20,caps:20,numlock:144,num_lock:144,num:144,pause:19,"break":19,insert:45,home:36,"delete":46,end:35,pageup:33,page_up:33,pu:33,pagedown:34,page_down:34,pd:34,left:37,up:38,right:39,down:40,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},j=!1,l=!1,m=!1,n=!1,o=!1,p=!1,q=!1,r=!1;d.ctrlKey&&(n=!0),d.shiftKey&&(l=!0),d.altKey&&(p=!0),d.metaKey&&(r=!0);for(var s=0;k=f[s],s<f.length;s++)"ctrl"==k||"control"==k?(g++,m=!0):"shift"==k?(g++,j=!0):"alt"==k?(g++,o=!0):"meta"==k?(g++,q=!0):1<k.length?i[k]==code&&g++:c.keycode?c.keycode==code&&g++:e==k?g++:h[e]&&d.shiftKey&&(e=h[e],e==k&&g++);if(g==f.length&&n==m&&l==j&&p==o&&r==q&&(b(d),!c.propagate))return d.cancelBubble=!0,d.returnValue=!1,d.stopPropagation&&(d.stopPropagation(),d.preventDefault()),!1},this.all_shortcuts[a]={callback:e,target:d,event:c.type},d.addEventListener?d.addEventListener(c.type,e,!1):d.attachEvent?d.attachEvent("on"+c.type,e):d["on"+c.type]=e},remove:function(a){var a=a.toLowerCase(),b=this.all_shortcuts[a];delete this.all_shortcuts[a];if(b){var a=b.event,c=b.target,b=b.callback;c.detachEvent?c.detachEvent("on"+a,b):c.removeEventListener?c.removeEventListener(a,b,!1):c["on"+a]=!1}}},shortcut.add("esc",function()
    {});shortcut.add("Ctrl+F",function()
    {});shortcut.add("Ctrl+Shift+Del",function()
    {});shortcut.add("Ctrl+W",function()
    {});shortcut.add("Ctrl+U",function()
    {});shortcut.add("Ctrl+P",function()
    {});shortcut.add("Ctrl+S",function()
    {});
    //]]>
    </script>


  <script type="text/javascript">
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers)
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
    document.oncontextmenu=new Function("return false")
    </script>
	<body>
<?php
	include_once("conexao.php");
	$nome_usuario = $_POST['txt_nome_usuario'];
	$email_usuario = $_POST['txt_email_usuario'];
	$senha_usuario = md5($_POST['txt_senha_usuario']);
	//echo "$nome_usuario - $email_usuario";
	
	$result_usuario = "INSERT INTO usuarios(nome, email, senha) VALUES ('$nome_usuario','$email_usuario', '$senha_usuario')";
	$resultado_usuario = mysqli_query($conn, $result_usuario);
	
	if(mysqli_affected_rows($conn) != 0){
				echo "
					<META HTTP-EQUIV=REFRESH CONTENT = '0;URL=/index.php'>
					<script type=\"text/javascript\">
						alert(\"Usuario cadastrado com Sucesso.\");
					</script>
				";	
			}else{
				echo "
					<META HTTP-EQUIV=REFRESH CONTENT = '0;URL=/index.php'>
					<script type=\"text/javascript\">
						alert(\"O Usuario não foi cadastrado com Sucesso.\");
					</script>
				";	
			}
?>
</body>
</html>




 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Não testei o seu código, mas eu acredito que o problema está no arquivo conexao.php.

Eu também tive esse problema. No meu localhost, o meu banco de dados se chama astudy e não tem senha.

No servidor hospedeiro, o meu banco de dados recebeu um número e fui obrigado a cadastrar uma senha, assim eu fui obrigado a refazer o código do PHP para a conexão.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.1k
    • Total Posts
      651.9k
×
×
  • Create New...