0

i have a two menu bar option which are home and my account
after login my user and pswd its show home page but when i change home to my account page its show message below and logout
Notice: Undefined index: user in folder\myaccount.php
Notice: Undefined index: pswd in folder\myaccount.php
you are not logged in

these both fields are my login page variables user and pswd

2
Contributors
4
Replies
27
Views
2 Weeks
Discussion Span
Last Post by NA
0

this is my code of login if i refresh my page its logout or menu bar also show logout

<?php
$userid = ($_POST['userid']);
$pswd = ($_POST['pswd']);
$conn = oci_connect('user', 'pswrd', 'db');

$query = "SELECT userid, pswd FROM staff
WHERE userid=:userid AND pswd=:pswd";

$stmt = oci_parse($conn, $query);
oci_bind_by_name($stmt, ':userid', $userid, 8);
oci_bind_by_name($stmt, ':pswd', $pswd, 32);
oci_execute($stmt);
list($userid, $pswd) = oci_fetch_array($stmt, OCI_NUM);
if ($userid != "" && $pswd !="")
{
$_SESSION['userid'] = $userid;
echo " logged in sucessfully!!!...";
}
else {
    echo"you are not logged in ";
    }

?>
0

Try this

<?php 

    session_start();

    $userid = ($_POST['userid']);
    $pswd = ($_POST['pswd']);
    $conn = oci_connect('user', 'pswrd', 'db');

    $query = "SELECT userid, pswd FROM staff
    WHERE userid=:userid AND pswd=:pswd";

    $stmt = oci_parse($conn, $query);
    oci_bind_by_name($stmt, ':userid', $userid, 8);
    oci_bind_by_name($stmt, ':pswd', $pswd, 32);
    oci_execute($stmt);
    list($userid, $pswd) = oci_fetch_array($stmt, OCI_NUM);
    if ($userid != "" && $pswd !="")
    {
    $_SESSION['userid'] = $userid;
    echo " logged in sucessfully!!!...";
    print_r($_SESSION);
    }
    else {
        echo"you are not logged in ";
        }

?>
0

still problem is same when i enter in url to refresh this error is show

Notice: Undefined index: userid in ...\login.php on line 3

Notice: Undefined index: pswd in ....\login.php on line 4
you are not logged in

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.