0
Hello, I wonder when someone is logged in to create a FILE type button. The registration and login system is created, but I do not know how to know when it is logged in or not.
index php.
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LuppBox</title>
<link rel="stylesheet" type="text/css" href="estilo_index.css"/>
</head>
<body bgcolor="#0099FF">
	<ul id="cabecario">
    	<li id="logo"><img src="fotos_site/logo.png" width="auto" height="60" /></li>  
        <li id="login_cadastro_css"><a href="login_cadastro.php">Login | Cadastro</a></li>         
    </ul>  
</body>
</html>
make login.php
<?
	include "connection.php";
	
	$login = $_POST['login_entrar'];
	$senha = $_POST['senha_entrar'];
	
	$sql = mysqli_query($coneccao, "SELECT * FROM usuarios WHERE login = '$login'");	
	
	
	while($linha = mysqli_fetch_array($sql))
	{
		$senha_db = $linha['senha'];
	}
	
	$cont = mysqli_num_rows($sql);
	
	if($cont == 0)
	{		
		echo "<meta http-equiv='refresh' content='0; url=index.php'>
		<script type='text/javascript'>alert('Este usuario não existe')</script>";		
	}
	else
	{
		if($senha_db != $senha)
		{
			echo "<meta http-equiv='refresh' content='0; url=index.php'>
			<script type='text/javascript'>alert('Senha incorreta')</script>";	
		}
		else
		{
			session_start();
			
			$_SESSION['login_usuario'] = $login;	
			$_SESSION['senha_usuario'] = $senha;
			
			header("location: perfil.php");	
		}
	}
	
	mysqli_close($coneccao);
?>
make registration.php
<?
	include "connection.php";
	
	$login = $_POST['login_entrar'];
	$senha = $_POST['senha_entrar'];
	
	$sql = mysqli_query($coneccao, "SELECT * FROM usuarios WHERE login = '$login'");	
	
	
	while($linha = mysqli_fetch_array($sql))
	{
		$senha_db = $linha['senha'];
	}
	
	$cont = mysqli_num_rows($sql);
	
	if($cont == 0)
	{		
		echo "<meta http-equiv='refresh' content='0; url=index.php'>
		<script type='text/javascript'>alert('Este usuario não existe')</script>";		
	}
	else
	{
		if($senha_db != $senha)
		{
			echo "<meta http-equiv='refresh' content='0; url=index.php'>
			<script type='text/javascript'>alert('Senha incorreta')</script>";	
		}
		else
		{
			session_start();
			
			$_SESSION['login_usuario'] = $login;	
			$_SESSION['senha_usuario'] = $senha;
			
			header("location: perfil.php");	
		}
	}
	
	mysqli_close($coneccao);
?>
I would like to put a FILE type button under that case you are logged in.
Grateful from now on.
Hello Eduardo, but he can’t check, he always says I’m not logged in even though I’m.
– Lucas Caresia
Do you want to put this button on which page, @Lucascarezia? Remember to put the
session_start()in the first line of your php script.– Eduardo Silva
Set to index.php
– Lucas Caresia