News:

The "Support Requests" forum is now viewable by guests.

Main Menu

COOKIES WON'T GO AWAY!

Started by sixthcrusifix, January 13, 2006, 07:48:21 AM

Previous topic - Next topic

sixthcrusifix

This simply does NOT delete my cookies for some reason! the cookies my other code made:

echo ("Goodbye $user you are now logged out!");
setcookie("user", FALSE);
setcookie($type, FALSE);
setcookie("wbb_userid", FALSE);
setcookie("wbb_userpassword", FALSE);
setcookie('Password',FALSE);

now I have these cookies paths set to "/" instead of "MAIM/ADMIN" like they really are because I couldn't access them everywhere. Izzat teh problem?
Visite me website at http://www.sixthcrusifix.com

webzone (archived)

You can't set cookies or customize headers after anything is "echo"ed.

setcookie() uses HTTP headers to do his work. However, the headers are sent right after your first call to "echo", so they can no longer be changed and your browser never receives the instruction to delete the cookie.

You'd have seen it right away if you had enabled error reporting in PHP (doing what you did should display a message of type E_WARNING).

sixthcrusifix

Quote from: webzone on January 13, 2006, 11:20:38 AM
You can't set cookies or customize headers after anything is "echo"ed.

setcookie() uses HTTP headers to do his work. However, the headers are sent right after your first call to "echo", so they can no longer be changed and your browser never receives the instruction to delete the cookie.

You'd have seen it right away if you had enabled error reporting in PHP (doing what you did should display a message of type E_WARNING).

oh I turned some error message off for what reason I can't remember.


BTW instead of posting a new thread,
when I use this:

if( (preg_match("<?",$Display)) || (preg_match("?>",$Display)) )
{
$Display = "Nice try but that PHP is NOT Allowed!";
}



I get this:
Quote
Warning: preg_match() [function.preg-match]: No ending matching delimiter '>' found in /fpgs/fpgshttpd/sixthcrusifix/pages/index.php on line 27

know why?
Visite me website at http://www.sixthcrusifix.com

webzone (archived)

I don't use preg_match often, but as far as I know, < and ? are part of the special characters used by the function. You probably only need to escape them using a backslash like \<\?

By the way, why do you need to check for PHP commands inside files? You don't need to do that except in one special situation: if you write the data provided by the user directly to a file and you set PHP to parse all files. Elsewhere, the test is not necessary.

sixthcrusifix

Quote from: webzone on January 13, 2006, 08:14:28 PM
I don't use preg_match often, but as far as I know, < and ? are part of the special characters used by the function. You probably only need to escape them using a backslash like \<\?

By the way, why do you need to check for PHP commands inside files? You don't need to do that except in one special situation: if you write the data provided by the user directly to a file and you set PHP to parse all files. Elsewhere, the test is not necessary.

what had happened is that I was using include instead of an iframe to let the user see a preview of their page but for SOME reason the PHP was WORKING even though it was in an echo! (I didn'treaize that visiting teh actuall page didn't let the PHP work) So I decided to use an iFRAME instead and now the PHP don't work. It must have been include (though I didn't think hat could happen in an echo)


BTW: My cookie problem was actually the cookie path. the MAIN directory couldn't delete cookes that were set to the MAIN/ADMIN directory. I just change dthat and it still works even with the echo above it but Imay change it anyways.


Also fo rthe PHP thing I found str_pos and it worked fine.
Visite me website at http://www.sixthcrusifix.com

webzone (archived)

QuoteBTW: My cookie problem was actually the cookie path. the MAIN directory couldn't delete cookes that were set to the MAIN/ADMIN directory. I just change dthat and it still works even with the echo above it but Imay change it anyways.

You're probably using some kind of outbut bufferring then. PHP has a setting to do that and it might be enabled.

Quotewhat had happened is that I was using include instead of an iframe to let the user see a preview of their page but for SOME reason the PHP was WORKING even though it was in an echo!

Indeed, if you include() something, PHP will look for script instructions in it.

sixthcrusifix

okay, no more include for me with stuff like that. Iframe is easier anyway because I can adjust the preview window size easier.
Visite me website at http://www.sixthcrusifix.com