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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:36:10+00:00 2026-06-05T04:36:10+00:00

Attempting to add a keep me logged in. Not exactly sure what I’m doing

  • 0

Attempting to add a “keep me logged in”. Not exactly sure what I’m doing wrong, but on the initial login when “keep me logged in” is checked, this will run:

$email_and_password = array($email_from_html, $pass_from_html);
setcookie("StayLoggedZod", $email_and_password, time()+3600*24*30);

$email_from_html & $pass_from_html are the user’s email and password being stored into an array and that being stored into a cookie.

Now when you go back to the site after leaving, the initial page does this:

if (isset($_COOKIE['StayLoggedZod'])) 
{
$email_and_password = $_COOKIE['StayLoggedZod'];
$stored_email = $email_and_password[0];
$stored_password = $email_and_password[1];
//USES THE E-MAIL AND PASS STORED IN HERE TO LOG INTO WEBSITE VIA MySQL DB, I EXCLUDED THIS CODE BECAUSE I KNOW THIS PART WORKS.
}
else
{
header("location:login.php");
}

It returns no errors, I couldn’t get it to work so I made a quick test page like this:

$cookie_data = $_COOKIE['StayLoggedZod'];
$the_email = $cookie_data[0];
$the_pass = $cookie_data[1];
$display_string = "This is my email".$the_email.". This is my password".$the_pass;
echo $display_string;

No data shows up aside from “This is my email” ect.

This is my first time making a keep my logged in, not sure what I’m missing, hope I was thorough with my explanation.
-Mike

  • 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-05T04:36:12+00:00Added an answer on June 5, 2026 at 4:36 am

    1) you should not store sensitive details like the password in a cookie. Cookies are stored on the client side and are editable and visible

    2) check the man page for setcookie http://php.net/setcookie

    you will see that the second parameter (the value that you want to store) should be a string (so if you want to store arrays think of a method to store them as a string like serialization or json encoding)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to add embedded documents. I know this syntax is wrong but
Basically I'm attempting to add rows to a table, I need to do this
I'm not sure if I'm just form building impaired or not thinking about this
I'm attempting to add a FB Like Box to a website I'm developing. Not
I'm attempting to add a UIImageView to the subview of a UILabel, but for
I am attempting to add a shape aesthetic mapping to an existing plot but
I am attempting add a tableadapter to a stored procedure in my SQL Server
I am attempting add some tests to an existing QT GUI application using QTest.
I am attempting to add a simple Blowfish password encoder to Symfony2. When a
I am attempting to add a Requested By field to a custom Work Item

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.