Jump to content

Archived

This topic is now archived and is closed to further replies.

Ninjakreborn

cookie

Recommended Posts

setcookie("username", $username, PHP_INT_MAX);
setcookie("password", $password, PHP_INT_MAX);
those are returning errors and they were not before.  I am using cookies instead of sessions for 2 reasons, it's simply for 1 persons admin page, he wanted cookies, and i don't have php.ini access.  It use to accept that last parameter, to make it a permanent cookie, but now it's not.

Share this post


Link to post
Share on other sites
I get the same error "Warning: setcookie() expects parameter 3 to be long, string given in /var/www/phpfreaks/cookies.php on line 2"

is it running above PHP 4.4.0?

as mine isnt and when i do
<?php
echo PHP_INT_MAX;
?>

it echo's PHP_INT_MAX...

Liam

Share this post


Link to post
Share on other sites
I said to hell with it, it worked,  then a few months later it stops working.  Server's were changes, so I got tired of it, I learnt a few new techniques about setting the domain name so I set that up this time, and changed that around and it works.  I think the php max int has something to do with the way php.ini is set, with that being the case, It is not something that is very safe.  ESPECIALLY if you are trying to write code that can go from server to server.  I have to figure out something.

[code]$expire = time() + (1000000*30);
setcookie("username", $username, $expire, "/administration/", ".funnyemailforwards.com",);
setcookie("password", $password, $expire, "/administration/", ".funnyemailforwards.com",);[/code]
Actually you can even take that 1 million mark and change that to 2-5 million or somethign I am unsure how much time that is, but it'll probably last quite a bit of the average humans lifespan, it's a simpler way to do it.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.