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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:01:02+00:00 2026-05-29T04:01:02+00:00

I have a PHP script located in my WordPress installation’s root folder wordpress-root/includes/login.php When

  • 0

I have a PHP script located in my WordPress installation’s root folder
wordpress-root/includes/login.php

When I login from the home page, I call this script via AJAX to log in a user.

This is what the script does:

if (eveything checks out)
{
    //set session variables to track user

    //generate a unique auth token
    //store auth token in db
    //set cookies   
    setcookie('email',$email,mktime(0,0,0,12,31,2012));
    setcookie('authtoken',$authtoken,mktime(0,0,0,12,31,2012));
}

The problem is everything above works fine, but the cookies won’t get set. I can see the entry being made in the database, and no errors or warnings are being thrown.

From another script, I do

var_dump($_SESSION); var_dump($_COOKIE);

I can see the session variables I set, as well as a bunch of cookies wordpress is setting, but I can’t see the cookies I just set.

Please note: The above login has nothing to do with WordPress’s login system. I’m creating my own login system.

  • 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-29T04:01:02+00:00Added an answer on May 29, 2026 at 4:01 am

    I dont’ know why, but far too often, I figure out the answer to a problem just as I post the question to SO :/.

    Anyways, got it to work by adding the remaining arguments for setcookie. I’m going it this way now:

    setcookie('email',$email,mktime(0,0,0,12,31,2012),'/','.example.com');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php script which accesses a MSSQL2005 database, reads some data from
I have a PHP script that works by calling items from a database based
Basically I have a php script located on a sever that generates a JSON
I have a PHP script, it is located in the same computer as my
I have a PHP script located on mysite.org and I use it to display
I have a PHP script located in path like /var/www/vhosts/hostname/httpdocs/webservices , I have both
I have a PHP script that uses cURL to access a file also located
I have to include in a php script some files that are located on
I have a directory of PHP scripts ( mainly utilities), that is located on
I have php script that creates a temporary watermark image for users that are

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.