Jump to content

[SOLVED] setcookie()...on fire!


cmgmyr

Recommended Posts

Ok...this I don't get...

 

I have:

if (isset($remember)){
				setcookie("user","$info",time()+1209600);
			}else{
				setcookie("user","$info",0);
			}

 

I can echo $info and it looks fine, but when i echo the cookie...nothing.

 

I have this in 2 sites on my local computer...one works...one doesn't. I don't know why it's not setting the cookie. (it's going to the else statement) any ideas?

 

Thanks

Link to comment
Share on other sites

it's just a checkbox on the login form...but with or without it, it should still set the cookie. The information sent from the form has been validated and set into variables ($info) and I can echo $info. But the actual cookie is not setting.

Link to comment
Share on other sites

It would if they are both set on localhost. Is there a way to distinguish the two? Maybe append the cookie name for the site.

 

IE site one use the name site1_user and for site2 use site2_user see if that works.

Link to comment
Share on other sites

I'm on a different computer now but now I'm getting this...

 

Line 59 is: setcookie("user","$info",0);

 

delete cookie

Warning: Cannot modify header information - headers already sent by (output started at C:\web\www\htdocs\tarson\header.php:8) in C:\web\www\htdocs\tarson\includes\do_login.php on line 59

Link to comment
Share on other sites

ok ok sorry I found it...

 

When I made my new config file I for got to copy:

<?php 
$phpver = phpversion();
if ($phpver < '4.1.0') {
$_GET = $HTTP_GET_VARS;
$_POST = $HTTP_POST_VARS;
$_SERVER = $HTTP_SERVER_VARS;
}
if ($phpver >= '4.0.4pl1' && strstr($_SERVER["HTTP_USER_AGENT"],'compatible')) {
if (extension_loaded('zlib')) {
	ob_end_clean();
	ob_start('ob_gzhandler');
}
} else if ($phpver > '4.0') {
if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
	if (extension_loaded('zlib')) {
		$do_gzip_compress = TRUE;
		ob_start(array('ob_gzhandler',5));
		ob_implicit_flush(0);
	}
}
}
$phpver = explode(".", $phpver);
$phpver = "$phpver[0]$phpver[1]";
if ($phpver >= 41) {
$PHP_SELF = $_SERVER['PHP_SELF'];
}

if (!ini_get("register_globals")) {
import_request_variables('GPC');
}
?>

 

now it works like a charm!

 

Thanks for all the help guys! The moral of the story...copy your WHOLE config file... ;D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.