php - storing users information in a session

require_once 'config.php';

if(isset($_POST['username']) && isset($_POST['password'])){

    $uname = $_POST['username'];
    $upass = $_POST['password'];

    //select users information from database
    $buildsql = "SELECT * FROM umembersd WHERE uusername = '$uname' AND       upassword = '$upass'";
    $myexec = mysqli_query($conn, $buildsql) or die (mysqli_error($conn));

    if($myexec->num_rows > 0){
        while($data = $myexec->fetch_assoc()){

            $_SESSION['no'] = 'id';
            $_SESSION['firstname'] = 'ufname';
            $_SESSION['lastname']= 'ulname';
            $_SESSION['phonenumber'] = 'uphone';
            $_SESSION['emailaddress']= 'uemail';
            $_SESSION['datejoined'] = 'uregdate';
            $_SESSION['datereg'] = 'uusername';

            header('location: index.php?successful');
        header('location: login.php?nerror');

People are also looking for solutions to the problem: php - PDFs generated with Dompdf library filling up tempfolder


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.