RE: [PHP] looking for a class that handles cookies and sessions

2001-06-30 Thread scott [gts]

read the manual!!!

there's a set cookie function built into PHP.



 -Original Message-
 From: Jason Stechschulte [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, June 27, 2001 9:30 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] looking for a class that handles cookies and sessions
 
 
 On Tue, Jun 26, 2001 at 12:44:15PM -0400, [EMAIL PROTECTED] wrote:
  I need a class that can quickly help me set cookies and sessions, and check 
  up against them
  
  anyone have an idea where i can get one like this?
 
 Yes, the University I work at has a class that will teach you this.  The
 University is at http://www.unoh.edu and the class you want is: DP237 -
 Programming Server-Side Scripts I  
 
 -- 
 Jason Stechschulte
 [EMAIL PROTECTED]
 --
 And we can always supply them with a program that makes identical files
 into links to a single file.
  -- Larry Wall in [EMAIL PROTECTED]
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] looking for a class that handles cookies and sessions

2001-06-28 Thread Richard Lynch

 I need a class that can quickly help me set cookies and sessions, and
check
 up against them

 anyone have an idea where i can get one like this?

If you can't find one in any of the umpteen PHP code archives linked from
http://php.net/links.php, here's one I wrote for you:

- session.inc -
?php
if (isset($session_id)){
# Look up $session_id in your database for their data
}
else{
session_start();
$session_id = PHP_SESSID; # I probably the PHP_SESSID bit wrong...
set_cookie('session_id', $session_id, time() + 2*365*24*60*60, '/');
# Insert default values with $session_id into your database.
}
?

Simply require 'session.inc' at the tip-top of every page that needs session
data.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] looking for a class that handles cookies and sessions

2001-06-27 Thread Jason Stechschulte

On Tue, Jun 26, 2001 at 12:44:15PM -0400, [EMAIL PROTECTED] wrote:
 I need a class that can quickly help me set cookies and sessions, and check 
 up against them
 
 anyone have an idea where i can get one like this?

Yes, the University I work at has a class that will teach you this.  The
University is at http://www.unoh.edu and the class you want is: DP237 -
Programming Server-Side Scripts I  

-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
And we can always supply them with a program that makes identical files
into links to a single file.
 -- Larry Wall in [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] looking for a class that handles cookies and sessions

2001-06-27 Thread teo

Hi PeterOblivion!
On Tue, 26 Jun 2001, [EMAIL PROTECTED] wrote:

 I need a class that can quickly help me set cookies and sessions, and check 
 up against them
 
 anyone have an idea where i can get one like this?
 
yes

http://www.webdev.ro/products/phpx/phpx.tgz

luckily enough, Daniel ([EMAIL PROTECTED]) put it up on this site so others can have access
to it.

it includes only the sources w/ no docs, but a simple example follows.
quick jumps to the colorful sources are:

 - http://www.webdev.ro/products/phpx/code.php?file=ScriptletRequest.php
 - http://www.webdev.ro/products/phpx/code.php?file=ScriptletResponse.php
 - http://www.webdev.ro/products/phpx/code.php?file=Session.php

$request  = new HttpScriptletRequest();
$response = new HttpScriptletResponse();

$a_variable = $request-getAttribute('variable.name');
$a_cookie   = $request-getCookie('baubau');
etc.
the full API of request is a bigger, just have a look, and quite easy to use.

/* for `slash trick' browsing u can use this: */
$request-setPathMapping('/module.name/module.entry/module.info');

if ($request-getAttribute('module.name') == 'News') {
// do stuff
}

an so, for an url like: http://www.foo.com/News/ShowNews/123

you have the mapping:
'module.name' - News
'module.entry' - ShowNews
'module.info'  - 123

of course u can use any name, just separate them with `/'.
   
/* for session support */

$session = $request-getSession();
$someCart = new Cart();
// to save it to the session
$session-setAttribute('cart.items', $someCart); 
// to get it (AS A COPY - changes aren't saved)
$otherCart = $session-getAttribute('cart.items');
// to get it AS A REFERENCE (changes are saved)
$otherCart = $sesion-getAttribute('cart.items');


You can use a $Request object as a containter/spacename for your variables
along the request processing to have a more elegant variables control, IMO.

Play with it, enhance it and share if you like :)

-- teodor

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]