0

Really hope this makes sense and someone can point me in right direction. On a registration page (parent page), when you enter a license code a jQuery ajax success function loads content from another page with an appended url to include a session id:

success: function(data) {
    if (data=="RegisterError") {
        $("#error").show();
        $("#processing").hide();
    } else {
        $("#contain").load("download-software.php?sessionid=xXXX #req");
        }
    }

The page "download-software" has the following PHP referrer check to make sure the content is being requested from the registration page via the session ID and redirects you if it's not:

<?php
$code = $_GET['sessionid'];
if(strcmp( $code , 'xXXX'  ) != 0) {
    header("Location: http://www.someotherpage.com");
}
?>

That works fine. Now what I need to do is in the "download-software #req" content that is loaded into the parent page, have a link that when clicked replaces the "download-software #req" content which has been loaded inside the parent page with content from another page and do the same type of session id check.

I cannot get it to work. I place the following code on the "download-software #req" content for the <a id="beta">beta notes $("#beta").click(function() { $("#req").load("NT7-SP1-Download.php #betaNotes"); });`

I've also tried using the .live function. How do I start a new session and make this work? *answer** I used the live function on the parent page and it works fine. Making it too hard i guess.

1
  • You might want to use Amazon S3 for this. You can generate a URL that is only valid for N minutes on successful authorization and just hand it to the user. Commented Feb 10, 2011 at 21:21

1 Answer 1

2

I would refrain from using GET query string parameters and use the included PHP session functions.

use:

<?php

// initialize the session 
session_start();

// assignment call
$_SESSION['key'] = 'value';

?>

You can retrieve data from the session on the same server in subsequent page requests.

When you are done with the session, use: session_destroy()

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.