I am trying to implement an active desktop intranet page. Logins, menu and first page of each application ( which shows refreshed data) works brilliantly. What i would like to do is setup up links that open IE windows where data is insert/review, pictures etc etc can be viewed

however, when the page opens up using something like


<form name=viewform	action='./action.php' method=post target=_blank>
<input type=hidden name=action value=view>
View existing logs <a href='JAVASCRIPT:viewform.submit()'>here</a>.
</form>

all session data is lost, where as if the intranet is used in the traditional webpage way from the start; new windows do not lose this data.

Is this clear?

would the answer be to create cookies with the session_id in it and reload this on each page that opens into a new page? ie something that replaces my verifcation code

session_start();
if(!session_is_registered('username')){
	header("location:../login_unsuccess.php");
}else{
 //blah blah
}

i am hoping this makes sense to you all

Is it possible to restart a session that is in /php/sessiondata by passing th e session_id() to another page?

Will i have to abandon sessiosn all together and use cookies? are cookies as good as sessions??

    I have just opened the session file on my server in notepad. It has similar structure to when you use serialize()/unserialize()....so i suppose i could pass the session_id to this new page, unserialize and put this back into a new session...no matter the session_id......

    will be back to say how i got on

      As a little test also try this - change the action of your form to

      action="./action.php?<?php echo session_name().'='.session_id(); ?>"

        Got it working:

        1.create form on start page in Active Desktop with original session data in hidden tags (<input type=hidden>)
        2.post this data to an 'action1' page in new window
        3.On 'action#1' start a new session, insert posted data into $_SESSION
        4.use header("location:./action2.php") to pass this data to the page(s) where it will be used

        my demo:

        <?
        //start.php - this page is the active desktop page: assume $_SESSION contains data. Mine is username, fullname, logintime and department
        session_start();
        //blah blah whatever code
        ?>
        //the link i want to load in new window
        <form name=test action='action1.php' method=post target=_blank>
        	<input type=hidden name=action value=view> //this is what i want to do
        	<input type=hidden name=username value='<?echo $_SESSION['username']; ?>'>
        	<input type=hidden name=fullname value='<?echo $_SESSION['fullname']; ?>'>
        	<input type=hidden name=logintime value='<?echo $_SESSION['logintime']; ?>'>
        	<input type=hidden name=department value='<?echo $_SESSION['department']; ?>'>
        	<a href='JAVASCRIPT:test.submit()'>Test</a>.
        </form>
        <!--end of start.php-->
        

        this is the first action page

        //action1.php
        <?
        session_start();
        $_SESSION['username']=$_POST['username'];
        $_SESSION['fullname']=$_POST['fullname'];
        $_SESSION['logintime']=$_POST['logintime'];
        $_SESSION['department']=$_POST['department'];
        $_SESSION['action']=$_POST['action'];
        unset($_POST);
        header("location:./action2.php");
        //end of action1.php
        ?>
        

        now tis the actual page where processing will be done: action2.php

        <?
        //action2.php
        session_start();
        if(!session_is_registered('username')){
        	header("location:../login_unsuccess.php");
        }else{
               print_r($_SESSION);
        }
        //end of action2.php
        ?>
        

        What do you think???
        Hope this is helpful for others

          Drakla wrote:

          As a little test also try this - change the action of your form to

          action="./action.php?<?php echo session_name().'='.session_id(); ?>"

          Sorry but unless im missing something on the target page/script, it doesnt work

          my scripts all start with

          <?
          session_start();
          if(!session_is_registered('username')){
          	header("location:../login_unsuccess.php");
          }else{
          
          

          unless i can tell session_start() to use a specific session id then it dont work

          At least i have something that works at this point in time and hopefully helpful to someone else

          thanks for your input

            This can all probably be solved by using the method I suggested, or just passing on the session id in a hidden variable - if called PHPSESSID (the default) it'll probably kick it self off all automatically, otherwise you can grab it in the next script and then set that as the session id and start the session. It saves all the faffing you've had to do.

              I should point out also that if you close the popup window, the should be some sort of script to destroy the session on the server

                must concede i have wasted a lot of time when you can actually start a session by a specified id ........ %$&£$£()&$£"£(£($*£(£@~£$~££@@'34#23[4324;23' -- bollox

                  Write a Reply...