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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:44:50+00:00 2026-06-08T02:44:50+00:00

So my website is setup to destroy sessions after 30 mins and i want

  • 0

So my website is setup to destroy sessions after 30 mins and i want to throw in a remember me option for users.

Essentially it would work like this, please excuse me for psuedo code

setcookie("sitename[id]", $userid, time()+60*60*24*30);
setcookie("sitename[pass]", $hasedandsaltedpassword);
setcookie("sitename[username]", $username);

So when a user is auto logged out I then check the cookie for usability

$count = $dbh->prepare("SELECT id FROM users WHERE name = :name AND id = :id AND pass = :pass");
    $count->bindParam(":name", $_COOKIE["sitename"]["username"]);
    $count->bindParam(":id", $_COOKIE["sitename"]["id"]);
    $count->bindParam(":pass", $_COOKIE["sitename"]["pass"]);
    $count->execute();
    $count = $count->rowCount();

and if the row count is above 0 but not greater than 1 then I set new session variables for them.

  • 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-08T02:44:53+00:00Added an answer on June 8, 2026 at 2:44 am

    That would work, but is not particularly secure. You are just comparing the pre-hashed password against your DB…so since the password does not ever change, you can essentially be giving anyone with access to the cookie the ability to log in anytime they want just by modifying the cookie data.

    I would suggest adding another table to the DB (or expanding the current user table) to include the IP address (or browser string + IP…all hashed…or whatever unique info you can about the specific user’s actual computer) of the computer that was being “remembered” and likewise a field for when that remembrance should expire. That way you can do two extra things: 1) expire the login early if needed and 2) validate that the cookie has not been extended. Even then it is not technically “secure” but you will be MUCH closer.

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

Sidebar

Related Questions

I have a setup like, My website ask the user for entering a URL.
My website is setup like: when the page loads, a jQuery animation -- in
I would like to allow my users to see other users data. I am
My website is setup with the content structure like this <body> <div id=header></div> <div
I setup my website to require unique email addresses (no two users can have
i have setup a website and using IIS7, now what i want to do
iam trying to setup an little search-engine for my website. I want to add
I am trying to setup the Jasmine Gem as described on their website. After
I have a requirement to setup a website that allows users, user blogs, a
I want to setup a website that uses an SQL Express .mdf file located

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.