Re: session cookies enabled?
| From: | itoctopus | Date: | Tue, 08 May 2007 22:50:45 +0000 |
| Subject: | Re: session cookies enabled? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-254603@lists.php.net to get a copy of this message | ||
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@softhome.net> wrote in message
news:courier.4640D5F4.00004E62@softhome.net...
> 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@SoftHome.net *
> * *
> **************************************