SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Include_once?

  1. #1
    SitePoint Member ferke's Avatar
    Join Date
    May 2003
    Location
    Hungary
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Include_once?

    Hi masters!

    Help me please about include:
    I have a module(login_auth.php) to handle session , it begins:

    PHP Code:
    session_start();
    session_register("session_vars");
     function 
    setsessionvars($blah)
     {
         global 
    session_vars;
         
    session_vars['login_pwd']=$blah;
     } 
    Then every module begins with some code:

    PHP Code:
    include ("login_auth.php"); 
    If I call in a module another module, and recall this, generating a redeclare error:

    In a.php:
    PHP Code:
    include ("login_auth.php");
    blah;
    include (
    "b.php");
    exit; 
    And b.php:
    PHP Code:
    include ("login_auth.php");
    blah;
    include (
    "a.php");
    exit; 
    If I use function include_once("login_auth.php") in a.php, the session_vars['login_pwd'] has no set when calling from b.php:

    In a.php:
    PHP Code:
    include_once ("login_auth.php");
    echo 
    session_vars['login_pwd']; //no value after recall!
    include ("b.php");
    exit; 
    Can somebody help me?

  2. #2
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try
    echo $HTTP_SESSION_VARS['login_pwd'];

    or
    print_r ($HTTP_SESSION_VARS);
    the neigbours (free) WIFI makes it just a little more fun


Bookmarks

Posting Permissions

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