Domanda

i'm building an website of sales and i need accounts for costumers and if the login is done

    session_start();
    include ("connbd.php"); where ligabd is the connection to the database
    $query = "SELECT * FROM clientes WHERE utilizador = '".$user."' AND pass = '".$pass."'";
    $result = mysqli_query($connbd,$query);
    $count = mysqli_num_rows($result);
    if (!$result) {

    $_SESSION['user']=$user;
    $_SESSION['password']=$pass;
    header("location:index.php");
}

now in the index page i have the label login and register, my question is how with:

if isset $_SESSION['user']
label register="" & label login =""
labeluser=$_SESSION['user']

how do i solve this?

È stato utile?

Soluzione

<?php
    session_start();

      if (isset $_SESSION['user']){
           $labelregister="";
           $labellogin ="";
           $labeluser=$_SESSION['user'];
      }
?>

Altri suggerimenti

put session_start(); on first line of the code

here is tutorial

enjoy :)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top