NYCPHP Meetup

NYPHP.org

[nycphp-talk] Simple form-based selection and cookie-setting/g etting

Sexton, David David.SextonJr at ubs.com
Thu Jul 31 14:25:18 EDT 2003


Say you named a cookie 'player_type' in another script and assigned a value
of 'real' or 'wmp' to it...
Reading the value back would go something like this...
 
if(isset($_COOKIE['player_type'])) {
    if($_COOKIE['player_type'] == "wmp") {
        //...statements/output for WMP
    }
    else {
        //...statements/output for REAL player 
    }
}
 
else {
    // Cookie doesn't exist... do whatever...
}

-----Original Message-----
From: Robert Dumas [mailto:rdumas at cmj.com]
Sent: Thursday, July 31, 2003 2:00 PM
To: 'NYPHP Talk'
Subject: RE: [nycphp-talk] Simple form-based selection and cookie-setting/g
etting



There's really no need for me to save the user's state on the server side of
things; all I need to do is set (and then, later, read) the cookie.

I've read the feature on php.net about cookies, but it simply talks about
creating them. What I'll need to do is have a PHP script in the popup player
that reads the cookie and outputs the code for the correct media player.
How do I do this?

-----Original Message----- 
From: Sexton, David [ mailto:David.SextonJr at ubs.com
<mailto:David.SextonJr at ubs.com> ] 
Sent: Thursday, July 31, 2003 1:14 PM 
To: 'NYPHP Talk' 
Subject: RE: [nycphp-talk] Simple form-based selection and 
cookie-setting/g etting 


Sounds like a plan... unless you foresee a use for maintaining state info 
down the line, and reliability isn't important (since clearing your cookies 
will wipe out your preference), then it's not worth the work, as Rolan 
suggested. Then again, if reliability isn't an issue, is it worth any effort

at all in trying to retain the pref? That's your preference... :) 

-----Original Message----- 
From: Robert Dumas [ mailto:rdumas at cmj.com <mailto:rdumas at cmj.com> ] 
Sent: Thursday, July 31, 2003 1:03 PM 
To: 'NYPHP Talk' 
Subject: RE: [nycphp-talk] Simple form-based selection and cookie-setting/g 
etting 



register/login is way morethan i need here; a simple cookie with the stored 
preference will do. If they don't choose a preferred player, they don't get 
the player. Simple as that. 

--RD 

-----Original Message----- 
From: Sexton, David [ mailto:David.SextonJr at ubs.com
<mailto:David.SextonJr at ubs.com>  
< mailto:David.SextonJr at ubs.com <mailto:David.SextonJr at ubs.com> > ] 
Sent: Thursday, July 31, 2003 12:41 PM 
To: 'NYPHP Talk' 
Subject: RE: [nycphp-talk] Simple form-based selection and 
cookie-setting/g etting 


...or require them to register/login, which would be more reliable since you


can store/retrieve the prefs server-side using sessions. Maybe you already 
have an existing login process, which would make it that much easier to 
implement. 


-----Original Message----- 
From: Rolan [ mailto:rolan at datawhorehouse.com
<mailto:rolan at datawhorehouse.com>  
< mailto:rolan at datawhorehouse.com <mailto:rolan at datawhorehouse.com> > ] 
Sent: Thursday, July 31, 2003 12:25 PM 
To: NYPHP Talk 
Subject: Re: [nycphp-talk] Simple form-based selection and 
cookie-setting/getting 


cookies. 
http://www.php.net/manual/en/features.cookies.php
<http://www.php.net/manual/en/features.cookies.php>  
< http://www.php.net/manual/en/features.cookies.php
<http://www.php.net/manual/en/features.cookies.php> >  

Robert Dumas wrote: 

> Hi all: 
> 
> I'm new to the list and I have a question. 
> 
> I'm building a streaming media player that opens in a pop-up (a 
> requested one, thank goodness) and I want to do it in PHP. Basically, 
> I want the user to select their preferred media player -- Real (ugh) 
> or WMP (double-ugh) -- and hit a link which saves their media player 
> preference and pops open the player.  Popping open the player is, of 
> course, no problem; but retrieving their preference is kind of sticky. 
> Does anyone know of a good example of a simple way to do this? 
> 
> Cheers 
> 
> Robert Dumas 
> 
>------------------------------------------------------------------------ 
> 
>_______________________________________________ 
>talk mailing list 
>talk at lists.nyphp.org 
> http://lists.nyphp.org/mailman/listinfo/talk
<http://lists.nyphp.org/mailman/listinfo/talk>  
< http://lists.nyphp.org/mailman/listinfo/talk
<http://lists.nyphp.org/mailman/listinfo/talk> >  



Please do not transmit orders or instructions regarding a UBS account by 
email. The information provided in this email or any attachments is not an 
official transaction confirmation or account statement. For your protection,

do not include account numbers, Social Security numbers, credit card 
numbers, passwords or other non-public information in your email. Because 
the information contained in this message may be privileged, confidential, 
proprietary or otherwise protected from disclosure, please notify us 
immediately by replying to this message and deleting it from your computer 
if you have received this communication in error.  Thank you. 

UBS Financial Services Inc. 
UBS International Inc. 

_______________________________________________ 
talk mailing list 
talk at lists.nyphp.org 
http://lists.nyphp.org/mailman/listinfo/talk
<http://lists.nyphp.org/mailman/listinfo/talk>  



Please do not transmit orders or instructions regarding a UBS account by
email. The information provided in this email or any attachments is not an
official transaction confirmation or account statement. For your protection,
do not include account numbers, Social Security numbers, credit card
numbers, passwords or other non-public information in your email. Because
the information contained in this message may be privileged, confidential,
proprietary or otherwise protected from disclosure, please notify us
immediately by replying to this message and deleting it from your computer
if you have received this communication in error.  Thank you.

UBS Financial Services Inc.
UBS International Inc.




More information about the talk mailing list