Jump to content

User panel edition


Joaon1

Recommended Posts

Hello!i need make a common User Panel
Where a user can edit the data of your account
I wish my code search the information in the database and let visible to the User, that could change when he wished.
I have too much trouble, Thank you in advance!
 
<?php
$host = "";
$database = "";
$user = "";
$password = "";
$conexao = mysql_connect($host, $user, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
    
?>

<html>
	<head>
		<title>escritorio</title>
	</head>
	<?php
	session_start();
	if(!isset($_SESSION["login"]) || !isset($_SESSION["senha"])) {
		header("location: login.php");
		exit;
	} else echo "<center>Voce esta logado!</center>";
	$consulta = mysql_query("select * from dados_usuarios where Login = '$login'");
	?>
	<body>
	<p>
			 </p>
		<p>
			 </p>
		<table align="center" border="1" cellpadding="20" cellspacing="1" class="table{display:block; width:auto; overflow-x: auto; white-space: nowrap;}" style="center: 500px ;width: px; height: 500px">
			<tbody>
				<tr>
					<td style="text-align: center; width: 550px;">
						<h1 style="color: blue;">
							<span style="font-size: 26px;">Escritorio</span></h1>
							
							<form action="alterar.php" method="post" name="signup">					
			<p style="text-align: center;">
				Login:</p>
				<input name="login" type="text" /></p>
			<p style="text-align: center;">
				Email:</p>
				<input name="email" size="50" type="text" /></p>
			<p style="text-align: center;">
				Senha:</p>
				<input name="senha" size="30" type="password" /></p>
			<p style="text-align: center;">
				Repita Senha:</p>
				<input name="Repita senha" size="30" type="password" /></p>
			<p style="text-align: center;">
				Nome:</p>
				<input name="nome" size="60" type="text" /></p>
			<p style="text-align: center;">
				País:</p>
				<input name="pais" size="30" type="text" /></p>
			<p style="text-align: center;">
				Estado:</p>
				<input name="estado" size="30" type="text" /></p>
			<p style="text-align: center;">
				Cidade:</p>
				<input name="cidade" size="40" type="text" /></p>
			<p style="text-align: center;">
				Cep:</p>
				<input name="cep" type="text" /></p>
				<p style="text-align: center;">
				whatsapp:</p>
				<input name="cep" type="text" /></p>
				<p style="text-align: center;">
				<input type="submit" value="alterar">
		</form>

						
							<a href="logout.php"><center><br /><br />Sair</center></a> 
					</td>
				</tr>
			</tbody>
		</table>
		<p>
			 </p>
		<p>
			<</p>
		<div align="center">
			Fprer todos os direitos reservados© 2014-<?php echo date("Y");
				?></div>
	</body>
</html>

is update.php

<?php
$host = "";
$database = "";
$user = "";
$password = "";
$conexao = mysql_connect($host, $user, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
    
$id_user = $_POST['id'];
$login_user = $_POST['login'];
$email_user = $_POST['email'];
$senha_user = $_POST['senha'];
$nome_user = $_POST['nome'];
$pais_user = $_POST['pais'];
$estado_user = $_POST['estado'];
$cidade_user = $_POST['cidade'];
$cep_user = $_POST['cep'];
$whatsapp_user= $_POST['whatsapp'];

if(empty($login_user) || empty($email_user) || empty($senha_user) || empty($nome_user) || empty($pais_user) || empty($estado_user) || empty($cidade_user) || empty($cep_user) || empty($whatsapp_user)){
	echo "<script>alert('Preencha todos os campos!');</script>";
	}else{
$sql= mysql_query("UPDATE usuarios SET login='$login_user', email='$email_user', senha='$senha_user', nome='$nome_user', pais='$pais_user', estado='$estado_user', cidade='$cidade_user', cep='$cep_user', whatsapp='$whatsapp_user' WHERE id='$id_user';");
if (!$sql)
{ echo "Não foi possivel atualizar seus dados :("; }
else
{
echo "<h2>Seus Dados Foram Atualizados com Sucesso <b>Aguarde....</b></h2><meta http-equiv='refresh' content='1;URL=login.php'>";
  }
}
?>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.