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 7542969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:18:24+00:00 2026-05-30T08:18:24+00:00

I have a question about tokens. I understand that they are random characters used

  • 0

I have a question about tokens. I understand that they are random characters used for security purposes but just how do they work and what do they protect against?

  • 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-30T08:18:26+00:00Added an answer on May 30, 2026 at 8:18 am

    Authentification mechanism creates a token when form displayed, and was stored it on server side.
    Also auth mechanism adds token as hidden input to form. When you send it, auth system check is it in server-side storage.
    If token found, authentification process will continue and token was removing.

    It protects from spamming form action script.

    Example using with logout url:

    <?php 
    // Generate token
    $logout_token = md5(microtime().random(100, 999));
    session_start();
    // Store token in session
    if (!is_array($_SESSION['logout_tokens']) {
        $_SESSION['logout_tokens'] = array();
    }
    $_SESSION['logout_tokens'][] = $logout_token;
    ?>
    <a href="/logout/?logout_token=<?= $logout_token ?>">logout</a>
    

    Script, that processing logout:

    <?php
    $done = false;
    if (!empty($_GET['logout_token'])) {
        // Get token from url
        $logout_token = $_GET['logout_token'];
        session_start();
        if (!is_array($_SESSION['logout_tokens']) {
            $_SESSION['logout_tokens'] = array();
        }
        // Search get token in session (server-side storage)
        if (($key = array_search($logout_token, $_SESSION['logout_tokens'], true)) !== false) {
            // Remove used token from storage
            unset($_SESSION['logout_tokens'][$key]);
            // Do logout
            $done = true;
        }
    }
    if ($done === false) {
       echo "Something went wrong.";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started the question differently, about a collection_select, but I found out that is
This question is about trying to understand the security risks involved in implementing oauth
I have an XML array that I access to pull a random question from.
I have one question about C2DM, I registered yesterday and I got email that
I know I've just asked a question about this, but I cannot figure out
I have question about parsing in Html helper : I have sth like: @foreach
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have question about XSLT1.0. The task is to write out in HTML all
I have question about normalization. Suppose I have an applications dealing with songs. First
I have question about interpreting strings as packed binary data in C++. In python,

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.