#1
  1. Charge into the Knight
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    Orlando, FL
    Posts
    276
    Rep Power
    13

    How to pass session id to <iframe> source page?


    How can I pass the session id to the iframe source page?
    I have a page called upload.php that has an <iframe> tag that loads upload2.php page. I use the following code to validate the user in upload2.php:

    PHP Code:
    //This validates the user to see if they had logged in. If the had not then the user
    //will be redirected to the login page.
    if (!session_is_registered("TheVaildWord")){
        
    header("Location: yourkickout.htm");
        exit;

    Any ideas? Thanks.
    Every man is a fool for at least five minutes every day; wisdom consists of not exceeding the limit.-- Elbert Hubbard
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2001
    Posts
    645
    Rep Power
    0
    if you are on php version > 4.1 then you shouldn't be using session_is_registered() as it is deprecated.

    also why do you want the session ID? if the iframe is on the ame site it should get the session info just fine if you start the page with sesion_start();

    if the page is a regular html file then how do you plan on using the variable anyway?
  4. #3
  5. Charge into the Knight
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    Orlando, FL
    Posts
    276
    Rep Power
    13
    If session_is_registered() is depreciated then what should I be using to check to see if the session variable is set? I am running 4.2.2.
    Every man is a fool for at least five minutes every day; wisdom consists of not exceeding the limit.-- Elbert Hubbard
  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2001
    Posts
    645
    Rep Power
    0
    just use

    if(isset($_SESSION['TheVaildWord'])){

    and then you can get the session variable just like this in the frame page,

    echo $_SESSION['TheVaildWord']
  8. #5
  9. Charge into the Knight
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    Orlando, FL
    Posts
    276
    Rep Power
    13
    Thanks
    Every man is a fool for at least five minutes every day; wisdom consists of not exceeding the limit.-- Elbert Hubbard

IMN logo majestic logo threadwatch logo seochat tools logo