I doing a web on the admin site...
I got this error,
"
Warning: setcookie() expects parameter 3 to be long, string given in /usr/local/web/httpdocs/admin/index.php on line 19

Warning: Cannot add header information - headers already sent by (output started at /usr/local/web/httpdocs/admin/index.php:19) in /usr/local/web/httpdocs/admin/index.php on line 20

"
Help Please!!....

    Originally posted by FidoDifo
    I doing a web on the admin site...
    I got this error,
    "
    Warning: setcookie() expects parameter 3 to be long, string given in /usr/local/web/httpdocs/admin/index.php on line 19

    Care to post the offending 'line 19' ?? 🙂

      Without even seeing the code I would hazard a guest that is something to do with date / time :p

        Sorri, here is the code... 🙂
        if (($POST["username"] == $name[0]) && ($POST["password"] == $pass[0])) {
        $date = getdate();
        $str_ulogin = "$date[mday] $date[mon]";
        $str_ulogin = implode("", unpack("H", $str_ulogin));
        $r1 = mt_rand(0,9) . mt_rand(0,9);
        $r2 = mt_rand(0,9) . mt_rand(0,9);
        $r3 = mt_rand(0,9) . mt_rand(0,9);
        preg_match("/(.{2})(.{2})(.{2})(.
        ?)$/", $str_ulogin, $reg);
        $str_ulogin = $reg[1] . $r1 . $reg[2] . $r2 . $reg[3] . $r3 . $reg[4];
        setcookie("alogin",$str_ulogin,"");
        header("Location: http://localhost/admin/admin.php");
        exit;
        }

          Hi.

          boolean setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]] )

          "" = string

          Try...

          setcookie( 'alogin', $str_ulogin );
          

            ...which is Icelandian for "leave off the expiry if you want a perma-cookie...don't set it to null"...

            Intenz, is, well Intensely accurate...

            and that's cool with me!!

              Write a Reply...