I've been doing a job and I need to finish php redirecting pro index along with a variable at the end of my login login. In the login I made a select where I returned the nickname of the user, now I need to send that nickname to the index in order to make other queries there from this nick. how can I do this without being exposed in the url or source code?.
I'm new to the web, I do not know how to do it.
I had made this code:
if(isset($_POST['submeter'])){
$email = $_POST['email'];
$pass = $_POST['senha'];
$pass = hash('sha256', $pass);
$stmt = $connect->prepare("SELECT loginUsuario FROM usuario WHERE email =? and senhaUsuario=?");
$stmt->bind_param('ss',$email,$pass);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows <=0){
echo "<h3 id='erro'>E-mail ou senha incorretos!</h3>";
}else{
$result= $stmt->bind_result($loginUsuario);
$stmt->fetch();
setcookie("login",$email);
header("location: index.php"); //passar $loginUsuario junto de alguma forma.
}
}