help with cookies

Discussion in 'PHP' started by Kyriakos, Jun 20, 2008.

  1. #1
    hi everybody,

    i want to create a user login system. i have this code in ASP:
    <?
    Response.$Cookies["username"] = trim(request("username"));
    Response.$Cookies["password"] = trim(request("password"));
    Response.$Cookies["username"].$Expires = dateadd("n",+30,now());
    Response.$Cookies["password"].$Expires = dateadd("n",+30,now());
    ?>
    <?
    $username = Request.$Cookies["username"];
    $password = Request.$Cookies["password"];
    ?>
    HTML:
    can anyone to translate this code to PHP?

    thanks in advance.
     
    Kyriakos, Jun 20, 2008 IP
  2. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #2
    <?
    setcookie("username", trim($_POST['username']), time() + 60*30);
    ?>
    
    <?
    $username = $_COOKIE['username'];
    ?>
    PHP:
    You remind me of myself when I was moving from ASP to PHP :) Good luck.
     
    Lordo, Jun 20, 2008 IP