#1
  1. Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Kristiansand - Norway
    Posts
    122
    Rep Power
    20

    Post Javascript and session id


    I have a page with a pulldown menu using onchange to automatically show a table, acording to what ever got selected from the pulldown menu.

    My problem is that I need to preserve the session id in the URL, or else I'll be booted out.

    What I'm using of code is this:
    Code:
    <script language="javascript"> 
    <!-- 
    //this function is used to navigate via the drop-down menu 
    function Navigate() { 
    var page = document.kontoplan.konti.selectedIndex; 
    var pageval = document.kontoplan.konti.options[page].value; 
    if (pageval == "x") return; 
    top.location = pageval; 
    } 
    //--> 
    </script>
    Wich is placed in the header of the HTML.
    further down I've got this:
    PHP Code:
    <form name="kontoplan" method="post" action="">
                        <table width="480" border="1" cellspacing="0" cellpadding="0" align="center">
                          <tr>
                            <td>
                              <select name="konti" onChange="Navigate()">
                                <option selected>Velg en...</option>
                                <option value="<? echo "$PHP_SELF?konti=ugle" ?>">Ugle</option>
                                <option value="kobra">Kobra</option>
                              </select>
                            </td>
                          </tr>
                          <tr>
                            <td>&nbsp;</td>
                          </tr>
                        </table>
                      </form>
    Now, this works fine, but it's skipping the SESSION ID, I've been using <? echo "$PHP_SELF" ?> many places and there it includes the session id...
    I've allso tried with this option value:
    <option value="<? echo "$PHP_SELF?PHPSESSID=$PHPSESSID?konti=ugle" ?>">Ugle</option>

    My guessing is that it is something in the JavaScrip that stips off the session id, and I'm not all that good at JS to find it.
    -=| Agnus Dei |=-
    http://www.crinos.org
  2. #2
  3. No Profile Picture
    I like buffy.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Location
    Sweden
    Posts
    6
    Rep Power
    0

    Wink


    I'm sure it's just a typing error but

    <option value="<? echo "$PHP_SELF?PHPSESSID=$PHPSESSID?konti=ugle" ?>">Ugle</option>
    should insted be

    PHP Code:
    <option value="<? echo "$PHP_SELF?PHPSESSID=$PHPSESSID&konti=ugle"?>">Ugle</option>

    //hebbe
  4. #3
  5. Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Kristiansand - Norway
    Posts
    122
    Rep Power
    20
    Same result
    I found another error though wich is corrected to be:
    <option value="<? echo "$PHP_SELF?konti=ugle&PHPSESSID=$PHPSESSID"; ?>">Ugle</option>
    Though.. Still same problem.

    If I remove the function to check for a valid session ID.
    The URL displays:
    http://192.168.100.1/secure_kontoplan.php?konti=ugle&PHPSESSID=d3b3d1f44548de632a394ba1e4f17808
    after I've selected something from the pull down menu.

    What have I done wrong?
    -=| Agnus Dei |=-
    http://www.crinos.org
  6. #4
  7. Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Kristiansand - Norway
    Posts
    122
    Rep Power
    20

    got it!


    Eh... guess a reload of the page did the thing! hehe..

    Sorry about that!
    -=| Agnus Dei |=-
    http://www.crinos.org

IMN logo majestic logo threadwatch logo seochat tools logo