Problem with cookies

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Miguel

    Problem with cookies

    Hello.

    I'm doing a login page in PHP and i'm with some problems with
    cookies:

    In a login.php, a cookie is set:
    ...
    setcookie("logg eduser","$usern ame", time() + 900, "/");
    header("Locatio n: index.php");
    ...


    In index.php the cokkie is tested and reloaded.

    if (isset($_COOKIE['loggeduser'])){
    $user = $_COOKIE['loggeduser'];
    setcookie("logg eduser","$user" , time() + 900, "/");
    }

    This procedure is performed each time a web page is loaded.

    The problem is that when i run the application in enviroment test
    (local server) it works fine but when the site is loaded from a real
    web server the cookie isn't set.

    Somebody can help me!
    Thanks

    Miguel
Working...