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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:10:03+00:00 2026-06-01T03:10:03+00:00

How do I access user_id: This is the print_r of my cookie: Array (

  • 0

How do I access user_id:
This is the print_r of my cookie:

Array
(
     [PHPSESSID] => gv0hsh6uel9kiuprdoc0uqboq4
     [oauth_token] => 40533855-FNM77JeuJIPdKclYyaT2Fi9jZRu2NGAHh5FeveNk
     [oauth_token_secret] => C6GDTEu60rGa4aDbqjncm6yfUf9Xc9520AuX9GXag
     [SocialAuth] => a:2:{s:4:"type";s:8:"facebook";s:7:"user_id";s:2:"22";}
     [__utma] => 157144508.1187834205.1333154906.1333154906.1333154906.1
     [__utmb] => 157144508.35.10.1333154906
     [__utmc] => 157144508
     [__utmz] => 157144508.1333154906.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
)

My user ID in this is at the end of the SocialAuth line… “22”. But I cant seem to access it.

$user = $_COOKIE["SocialAuth"]["user_id"];

Returns “a”.

Am I doing this right?
Thanks in advance.

  • 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-06-01T03:10:04+00:00Added an answer on June 1, 2026 at 3:10 am

    You have a serialized array in $_COOKIE['SocialAuth']. Take a look at the manual pages for serialize and unserialize.

    Use unserialize like this to access the user id:

    $user = unserialize($_COOKIE['SocialAuth'])['user_id'];
    

    Or prior to PHP 5.4:

    $arr = unserialize($_COOKIE['SocialAuth']);
    $user = $arr['user_id'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object that looks like this when outputted via a print_r Array
I have stores this object in an variable called results. How would i access
I have a command line argument user_id as --uid. I want to access the
Is it best to check for a null User when trying to access UserID
Currently since I want to access user information in all my templates, I always
I am writing an HTMLHelper but I need to access User.Identity.Name, how do I
I want to access the user data as global in whole website. I make
I want to give a user access to a stored procedure, but not to
I have detailed stats on user access to my system detailing login and logout
How can I let a user access a WordPress protected page with a URL

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.