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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:42:28+00:00 2026-05-26T15:42:28+00:00

I have a method where i check the username and password(hash+salt) is correct. After

  • 0

I have a method where i check the username and password(hash+salt) is correct. After that, and if the user have acess i do:

 if(isset($remember) && $remember == '1') {
        setcookie('email', $email,  time()+60*60*24*100);
    }
    else {
        setcookie('email', $email, time()+3600);
    }

My question is about security issues. the code above is insecure ? It is needed something like a signature ?

for example:

$user_email = $email;
$hash = sha1(rand(0,500).microtime());
$signature = sha1($hash . $user_email); 
$cookie = base64_encode($signature . "-" . $hash . "-" . $user_email);
setcookie('authentication', $cookie); 

What do you think ?

  • 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-26T15:42:29+00:00Added an answer on May 26, 2026 at 3:42 pm

    Anecdote time: Back around 2002 I was looking at a packet dump from my school’s network and told them that they needed to fix their grades, attendance, student information, everything-under-the-sun system. The way they had it set up was such that after a user authenticated, the system would set a cookie with just the user name and an end-of-session expiry. I fired up a browser, picked a username (first initial, last name), and set that as a cookie. I had access.

    What they should have done was set a random 128 number and kept track of that in the server (number, corresponding user, timeout value).

    See also

    • Good session practices.

    • How to securely hash passwords.

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

Sidebar

Related Questions

I have a dropdown box where the user can select a method to check
I have this very simple method called to check if a user has a
I have created a method to check if the keyboard is used in an
i have one setinterval method which call php script every 3 sec to check
Does a method which I check for with respondsToSelector have to actually exist? What
I have a method that checks spots in a 2D array, and it also
i currently have a method that checks what is around the centre item in
I have an HTML form: <form action='process.php' method='post'> <input type='checkbox' name='check_box_1' /> Check me!<br>
I have method that returns Drawable , and if its Bitmap object is recycled
HTML: <form method=post id=NewUserRegistration action=inc/q/addNewUser.php> Username: <input type=text name=userName /> <br /> Password: <input

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.