Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    13

    Arrow Unanswered: php 4.3.4 gives error

    This looks very simple but i dont know how to get rid of this problem
    I have a index.php file in which it check either the user is logged in or not if not then redirect to login page else go on to the administration section

    its some thign like this

    if($_SESSION['user'])){
    include("source/login/login.php");
    # i assign $_session['user'] when the user logs in only
    # so that if his session breaks he have to relogin
    }
    else
    {
    // some html tags
    }

    but now this is giving me this error

    PHP Notice: Undefined index: user in /var/www/vh2021/html-bin/management/index.php on line 32

    i tried to use isset() to check $_session'[user'] but doesnt work

    please if any one can help me with this
    Manish Khanna
    manish@i4u.com.au

  2. #2
    Join Date
    Feb 2004
    Posts
    2
    Here is one of the suggestion for your problem :

    If you are passing value to say next page , define the get method at every page that accepts the value : e.g define something like $value=$_GET['value']; in the next page.

    I hope that this solves the problem ... but would like to get feedback if someone knows how to solve this problem without using get or post method.

  3. #3
    Join Date
    Jan 2004
    Location
    India
    Posts
    168

    Lightbulb Re: php 4.3.4 gives error

    The session variable 'user' is set or not or does it have any value or not, this is you requirement and you are getting an erro notice. Just turn off that notice in the php.ini file and your problem is solved.
    This is the value to be set in the PHP.ini file for error reporting:
    E_ALL & ~E_NOTICE

    Regards

    Rajesh


    Originally posted by i4u_dev4
    This looks very simple but i dont know how to get rid of this problem
    I have a index.php file in which it check either the user is logged in or not if not then redirect to login page else go on to the administration section

    its some thign like this

    if($_SESSION['user'])){
    include("source/login/login.php");
    # i assign $_session['user'] when the user logs in only
    # so that if his session breaks he have to relogin
    }
    else
    {
    // some html tags
    }

    but now this is giving me this error

    PHP Notice: Undefined index: user in /var/www/vh2021/html-bin/management/index.php on line 32

    i tried to use isset() to check $_session'[user'] but doesnt work

    please if any one can help me with this

  4. #4
    Join Date
    Feb 2004
    Posts
    2

    Thanks for the solution Mr. Rajesh_r_r

    I would like to thank Mr. Rajesh for the solution for the problem . I did turned off the error_reporting in php.ini and i don't get any errors. Well, i did learn some basic stuffs about using isset functions and assigning values to variables before using them.

    Thanks once again.
    Abishek

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •