PHP Cookie is Not Working

PHP Cookie is Not Working Here But In My Local Server it Works
Can anyone Help ?
( The Code Of The Cookie is correct )

This may help

https://forum.infinityfree.com/search?q=cookie

2 Likes

I moved your topic to the support forum. And yes, we can help.

Can you please explain what the issue is? Share a link to a page which should use cookies, explain what it should do and what it actually does, share code snippets, and any other information that may be useful for us to diagnose the issue?

4 Likes

setcookie(
“LOG”,
$hashed_id,
time() - (10 * 365 * 24 * 60 * 60),
“/”,
“localhost”,
true,
true
);
This is The cookie Code it Must Be Set When i Click The on a Button and This Works in My local Server but When go to my uploaded Website and Click it The Cookie is Not Set.

    setcookie(
        "LOG",
        $hashed_id,
        time() + (10 * 365 * 24 * 60 * 60),
        "/",
        "localhost",
        true,
        true
    );

This is The Code im Sorry

1 Like

This is obviously why. The cookie will bot be set because it is for the wrong hostname.

5 Likes

yeah it was the proplem and i Fixed it , Thanks

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.