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

  • SEARCH
  • Home
  • 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 703281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:48:50+00:00 2026-05-14T03:48:50+00:00

Hey guys, one more quick question for any experts out there. I have a

  • 0

Hey guys, one more quick question for any experts out there. I have a form that is submitted via jquery ajax, works perfectly (I tested), and uses a form token (I set a session variable and pass through form and check that the token is equal to the posted token to prevent csrf attacks, see below…). My question is that I defined my session variable on the form page and used php session_start() on the validation page, but I am not sure how $_SESSION[‘token’] is still defined if I am not actually posting to that page or physically accessing that page with my browser (I am sending an ajax call). How $_SESSION[‘token’] be defined on a remote page?

Ex. set variable

if (!isset($_SESSION['token']) and $session->logged_in)
{
$_SESSION['token'] = md5(uniqid(rand(), TRUE));
}
$token =$_SESSION['token'];

pass token through form in hidden input, then check

if ($_POST['token'] == $_SESSION['token']){
  • 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-14T03:48:50+00:00Added an answer on May 14, 2026 at 3:48 am

    The session_id is passed from page to page via a cookie (in most cases, at least) — by default, called PHPSESSID.

    The session extension uses that cookie to determine which session is associated to the current user.

    Basically, there is nothing you have to do : PHP deals with loading and saving data from and to $_SESSION automatically 😉

    For more informations, you can take a look at the Session Handling section of the PHP manual, and, more specifically :

    • Passing the Session ID
    • session.use_cookies and a couple of other related configuration directives
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys I have one more question lol. I am using a script that
Hey guys, quick question. I have a table of messages. There are two types
Hey guys, just wondering if this one is possible I have an app that
Hey guys, I have a program that allows me to run queries against a
hey guys i want to create one display form in which at the bottom
Hey guys, have a little issue i need to figure out. I created a
Hey guys. I have a question. I have two different arrays with different structure
hey guys, i'm designing a C++ program that reads a sequence of one or
Hey guys i wrote a quick test. I want delete to call deleteMe which
Hey guys! Was wondering is anyone had any suggestions on books or other resources

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.