Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    32
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Sessions Don't Work

    On my website I have a big IFrame which all my content is viewed in. I also have a search script, which I want to load the results into the IFrame. I've been using GET to do it, but I want to move to sessions for more safety and it seems not to work. I've shown both of my scripts below, hope you can help. :D
    The page with the big IFrame (mark.php or / (with .htaccess)):
    PHP Code:
    <?php
    if (isset($_GET['p']) || isset($_POST['p']) || isset($_SESSION['p'])) {
      if (isset(
    $_GET['p'])) {  
        
    $p $_GET['p'];
      }
      elseif (isset(
    $_SESSION['p'])) {
        
    $p $_SESSION['p'];
        unset(
    $_SESSION['p']);
      }
      else {
        
    $p $_POST['p'];
      }
    }
    elseif (!isset(
    $_GET['p']) && !isset($_GET['p']) && !isset($p) && !isset($_SESSION['p'])) {
      
    $p "news.php";
    }
    ?>
    Code:
    <iframe id="content" src="http://harsh.bplaced.com/<?php echo $p; ?>" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>
    The search page (search.php):
    PHP Code:
    <?php
    session_start
    (); 
    $_SESSION['p'] = "search_.php?query=" $_POST['query'];

    header("Location: http://www.harsh.bplaced.com/"); 
    ?>

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Frames are a pain.
    You'll need to force you're write if I'm not mistaken, though it has been a looooooonnnnggg time since I've used the session extension. Look at session_write_close()/session_commit().
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    New Coder
    Join Date
    May 2009
    Posts
    32
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    Frames are a pain.
    You'll need to force you're write if I'm not mistaken, though it has been a looooooonnnnggg time since I've used the session extension. Look at session_write_close()/session_commit().
    Sorry to bug you, but I've tried placing it all over the code but I still can't seem to get it to work. I might just go back to GETing the the variable.
    PHP Code:
    <?php
    session_start
    (); 
    $_SESSION['p'] = "search_.php?query=" $_POST['query'];
    session_write_close();
    header("Location: http://www.harsh.bplaced.com/"); 
    ?>


  •  

    Posting Permissions

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