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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:03:39+00:00 2026-05-16T00:03:39+00:00

I have a three pieces of code that are giving me trouble. This one

  • 0

I have a three pieces of code that are giving me trouble.

This one sets the cookie

setcookie("verify", "$value", time()+3600);  

This one is on a different page, it makes sure the cookie has the correct value

if ( $_COOKIE["verify"] != file("name.txt")) { 
header("location: notset.html");
} else { die;  }

And this one deletes the cookie

setcookie("verify", "", time()-3600);

The code to write the cookie doesn’t actually write the cookie. And the variable is set, but no matter what the cookie will not set. So when I manually input the value by writing “test” and write test to “name.txt” and go to the page with the IF statement, it will take me to notset.html. Any ideas on why this isn’t working?

Oh and the delete cookie code works when I enter the test into both the cookie and name.txt. So the delete code works, but the first two do not.

  • 1 1 Answer
  • 1 View
  • 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-16T00:03:40+00:00Added an answer on May 16, 2026 at 12:03 am

    Your test fails because $_COOKIE["verify"] is a string but file is returning an array (array of lines in the file). If you want to load a file’s content into a string, use file_get_contents.

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

Sidebar

Related Questions

I have a piece of code that clones three fields, but when it clones
I have lots of small pieces of code that look like: for it in
I have this little piece of code that just checks for a particular text
I've got a bit of code that is giving me some trouble. I'm trying
I have these two pieces of code that each return a relation inside the
I have two pieces of code that I'm using to learn about multiprocessing in
I have a piece of code that looks like this: downloadsByExtensionCount = defaultdict(int) downloadsByExtensionList
I have a table that contains three pieces of patient information. Diagnosis_ID Patient_ID Diagnosis_Code
how I can run my code one piece at a time. That is, I
I have a piece of code that clones three fields, but when it clones

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.