Re: session cookies enabled?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



setcookie("cookie_name", "value");
//redirect to another page using header
header("location:".$your_url);

//check in $your_url for the presence for the cookie
if ($_COOKIE["cookie_name"] == "value"){
    //cookies are enabled - add your code
}
else{
    //cookies are disabled - add your code
}

Hope that helps!


-- 
itoctopus - http://www.itoctopus.com
<ccspencer@xxxxxxxxxxxx> wrote in message 
news:courier.4640D5F4.00004E62@xxxxxxxxxxxxxxx
> Richard Lynch writes:
>>> How does one check to see if the user's browser accepts
>>> session cookies?
>
> Apparently I should have said cookie and left off the 's' as
> that is what I had in mind.
>> Send one cookie, see if it comes back, and if it does, tie everything to 
>> that cookie.
>
> OK.  So how do I see if it comes back?
> I send the user a page that tries to set a session cookie.  That
> page would then have to forward him to a second page which would
> check for the cookie being sent.  Right?
> So I there is nothing I can check so I can do it with a single page?
>> You can also set up php.ini and use the built-in sessions with
>> http://php.net/session_start so that PHP will take care of this for you.
>
> That is what I was intending to do.  How do I find out if whether
> or not the session cookie was accepted using the built-in sessions?
> I found no function for such a test.
> Best,
> Craig
>
>
> ------------------------------------------------------
> -     Virtual Phonecards - Instant Pin by Email      -
> -           Large Selection - Great Rates            -
> -     http://speedypin.com/?aff=743&co_branded=1     -
> ------------------------------------------------------ 
>
>
> **************************************
> *                                    *
> *          Craig Spencer             *
> *      ccspencer@xxxxxxxxxxxx        *
> *                                    *
> ************************************** 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux