Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4036246
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:11:59+00:00 2026-05-20T12:11:59+00:00

On my site, forms are brought in via AJAX and checked against a sessionid.

  • 0

On my site, forms are brought in via AJAX and checked against a sessionid. I know this is not optimal, but it’s working for us. If the referrer doesn’t have the session ID they are redirected back to “anotherpage”. I need to allow some outside URL’s access the form directly.
we set the sessionid on the page with the link to the form.

Here is what we have now on the form page:

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

I need to allow some outside domains direct access to the form page and am having issues with this:
(I’m putting it above the head tag on the form page)

<?php
    $code = $_GET['sessionid'];
    $referrer = $_SERVER['HTTP_REFERER'];

    if(strcmp( $code , 'XXXXX' ) !=0) {
        header("Location: http://www.domain.com/anotherpage.php");
    } else {
        if (preg_match("/site1.com/",$referrer)) {
            header('Location: http://www.domain.com/desiredpage.php');
        }
    }
?>

this still bounces me back to “anotherpage.php” any ideas?

********EDIT*******
thx for the help, it works ad I requested. Now I see what I asked wasn’t entirely correct. This appends the URL with =sessionid?=XXXXX. This isn’t an issue on my site because I’m loading the content with .jquery .load so the URL doesn’t change. I don’t want the sessionid to be visible, and now it is. Can I either a) “trim” the url somehow or b) separate the two functions so they are exclusive?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T12:11:59+00:00Added an answer on May 20, 2026 at 12:11 pm
    if(strcmp( $code , 'XXXXX' ) !=0) {
        if (preg_match("/site1.com/",$referrer)) {
            header('Location: http://www.domain.com/desiredpage.php');
        } else {
            header("Location: http://www.domain.com/anotherpage.php");
        }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i developed an asp.net site using forms based authentication, that site is working when
I'm working on a site with forms that require a certain language to be
I have a standard ASP.NET MVC site with forms authentication. Users log in via
I need to be able to login to a site via Forms Authentication using
I'm working on a site that uses Forms Authentication. I was interested in how
I know MVC controllers are quite good at serving JSON formatted AJAX requests, but
While deveoping a site (using Forms authentication and InProc sessionstate) a frequently run into
I have public site with some forms. Simple question: What kind of informations should
I have an ASP.NET Web Forms web site. It has a page inside of
I use several forms on my site to send data to MySQL. Which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.