Re: Checking for cookies/session_existance.. very basic.
| From: | Chris Lee | Date: | Wed, 29 Nov 2000 03:17:17 +0000 |
| Subject: | Re: Checking for cookies/session_existance.. very basic. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27853@lists.php.net to get a copy of this message | ||
You probably have --enable-trans-sid enabled when you compiled php, thus
when sessions are created they will first try cookies, if this fails it
will automaticaly try adding PHPSESSID= to all your links.
if you ONLY want to use cookie's try the setcookie() command.
http://www.php.net/manual/function.setcookie.php
<?
if (!isset($done))
{
$CookieID = time();
$Exp = time() + 2592000 ;
setcookie("CookieID", $CookieID, $Exp, "/", ".somesite.com");
header("Location: http://$SERVER_NAME$PHP_SELF?done=1");
exit();
} else
{
if (isset($CookieID))
echo "Damn Cookies<br>\n";
else
echo "Great no cookie support<br>\n";
}
?>
Now onto other business, just for curiousity why do you say that if the
user can't use cookie's that your site is insecure? you know that cookie
values are stored localy on the clients computer and can be very very
easily changed right.? in netscape and IE their plain text files. just
open in notepad and change the value, restart your broser, and your done
:)
I use setcookie() rarly and much prefer sessions. I would like more
information on why you say this.
Chris Lee
Mediawaveonline.com
In article
<A8D9B16D2196D2118B6E00A0C9E307F43B04F0@beachpdc1.beachassociates.com>,
cday@beachassociates.com wrote:
> I must be doing something very simple wrong.. I want to reject a user
> from my site if they aren't using cookies (for lack of a better method
> right now.. people who reject cookies can currently abuse the site I am
> working on)..
>
> I thought this code would do it:
>
> (start session)> (register var)
>
> if (!session_is_registered("my var")) {
> exit();
> }
>
> but it doesn't work.. can someone clue me into what I'm doing wrong?
>
> Thanks, Chad Day Beach Associates
>
> When I speak german... I think german in my head... but like...Do skript
> kiddies see a w40l3 8uncha 1's and 0's and 3's and 4's and 7's in
> their
> h34d'5 w43n t43y R +a1k1n6 ? -- SirStanley
>
>